Full Code of nothings/stb for AI

master 28d546d5eb77 cached
145 files
4.2 MB
1.1M tokens
2642 symbols
1 requests
Download .txt
Showing preview only (4,384K chars total). Download the full file or copy to clipboard to get everything.
Repository: nothings/stb
Branch: master
Commit: 28d546d5eb77
Files: 145
Total size: 4.2 MB

Directory structure:
gitextract_kez3kfrp/

├── .NO_AI/
│   └── README.md
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── 1-stb_image-doesn-t-load-specific-image-correctly.md
│   │   ├── 2-bug_report.md
│   │   ├── 3-feature_request.md
│   │   └── config.yml
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── ci-fuzz.yml
├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── data/
│   └── herringbone/
│       └── license.txt
├── deprecated/
│   ├── rrsprintf.h
│   ├── stb.h
│   ├── stb_image.c
│   ├── stb_image_resize.h
│   ├── stretch_test.c
│   ├── stretchy_buffer.h
│   └── stretchy_buffer.txt
├── docs/
│   ├── other_libs.md
│   ├── stb_howto.txt
│   ├── stb_voxel_render_interview.md
│   └── why_public_domain.md
├── stb_c_lexer.h
├── stb_connected_components.h
├── stb_divide.h
├── stb_ds.h
├── stb_dxt.h
├── stb_easy_font.h
├── stb_herringbone_wang_tile.h
├── stb_hexwave.h
├── stb_image.h
├── stb_image_resize2.h
├── stb_image_resize_test/
│   ├── dotimings.c
│   ├── old_image_resize.h
│   ├── oldir.c
│   ├── stbirtest.c
│   └── vf_train.c
├── stb_image_write.h
├── stb_include.h
├── stb_leakcheck.h
├── stb_perlin.h
├── stb_rect_pack.h
├── stb_sprintf.h
├── stb_textedit.h
├── stb_tilemap_editor.h
├── stb_truetype.h
├── stb_vorbis.c
├── stb_voxel_render.h
├── tests/
│   ├── Makefile
│   ├── c_lexer_test.c
│   ├── c_lexer_test.dsp
│   ├── caveview/
│   │   ├── README.md
│   │   ├── cave_main.c
│   │   ├── cave_mesher.c
│   │   ├── cave_parse.c
│   │   ├── cave_parse.h
│   │   ├── cave_render.c
│   │   ├── caveview.dsp
│   │   ├── caveview.dsw
│   │   ├── caveview.h
│   │   ├── glext.h
│   │   ├── glext_list.h
│   │   ├── main.c
│   │   ├── stb_gl.h
│   │   ├── stb_glprog.h
│   │   └── win32/
│   │       └── SDL_windows_main.c
│   ├── fuzz_main.c
│   ├── grid_reachability.c
│   ├── herringbone.dsp
│   ├── herringbone_generator.c
│   ├── herringbone_map.c
│   ├── herringbone_map.dsp
│   ├── image_test.c
│   ├── image_test.dsp
│   ├── image_write_test.c
│   ├── ossfuzz.sh
│   ├── oversample/
│   │   ├── README.md
│   │   ├── main.c
│   │   ├── oversample.dsp
│   │   ├── oversample.dsw
│   │   └── stb_wingraph.h
│   ├── pbm/
│   │   ├── basi0g16.pgm
│   │   ├── basi2c16.ppm
│   │   ├── cdfn2c08.ppm
│   │   ├── cdun2c08.ppm
│   │   ├── comment.pgm
│   │   └── ctfn0g04.pgm
│   ├── pg_test/
│   │   └── pg_test.c
│   ├── pngsuite/
│   │   ├── PngSuite.LICENSE
│   │   └── ref_results.csv
│   ├── prerelease/
│   │   └── stb_lib.h
│   ├── resample_test.cpp
│   ├── resample_test_c.c
│   ├── resize.dsp
│   ├── sdf/
│   │   └── sdf_test.c
│   ├── stb.c
│   ├── stb.dsp
│   ├── stb.dsw
│   ├── stb_c_lexer_fuzzer.cpp
│   ├── stb_cpp.cpp
│   ├── stb_cpp.dsp
│   ├── stb_png.dict
│   ├── stb_static.c
│   ├── stbi_read_fuzzer.c
│   ├── stblib.dsp
│   ├── stblib_test.c
│   ├── stblib_test_companion.c
│   ├── stretch_test.dsp
│   ├── test.sbm
│   ├── test_c_compilation.c
│   ├── test_c_lexer.c
│   ├── test_cpp_compilation.cpp
│   ├── test_ds.c
│   ├── test_ds_cpp.cpp
│   ├── test_dxt.c
│   ├── test_easyfont.c
│   ├── test_image.c
│   ├── test_image_write.c
│   ├── test_perlin.c
│   ├── test_png_paeth.c
│   ├── test_png_regress.c
│   ├── test_siphash.c
│   ├── test_sprintf.c
│   ├── test_truetype.c
│   ├── test_vorbis.c
│   ├── test_voxel.c
│   ├── textedit_sample.c
│   ├── tilemap_editor_integration_example.c
│   ├── truetype_test_win32.c
│   └── vorbseek/
│       ├── vorbseek.c
│       └── vorbseek.dsp
└── tools/
    ├── README.footer.md
    ├── README.header.md
    ├── README.list
    ├── build_matrix.c
    ├── easy_font_maker.c
    ├── make_readme.c
    ├── make_readme.dsp
    ├── mr.bat
    ├── trailing_whitespace.c
    ├── unicode/
    │   └── unicode.dsp
    └── unicode.c

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

================================================
FILE: .NO_AI/README.md
================================================

[Use of AI is forbidden, see CONTRIBUTING.md for details.](../CONTRIBUTING.md)



================================================
FILE: .github/ISSUE_TEMPLATE/1-stb_image-doesn-t-load-specific-image-correctly.md
================================================
---
name: stb_image Doesn't Load Specific Image Correctly
about: if an image displays wrong in your program, and you've verified stb_image is
  the problem
title: ''
labels: 1 stb_image
assignees: ''

---

1. **Confirm that, after loading the image with stbi_load, you've immediately written it out with stbi_write_png or similar, and that version of the image is also wrong.** If it is correct when written out, the problem is not in stb_image. If it displays wrong in a program you're writing, it's probably your display code. For example, people writing OpenGL programs frequently do not upload or display the image correctly and assume stb_image is at fault even though writing out the image demonstrates that it loads correctly.

2. *Provide an image that does not load correctly using stb_image* so we can reproduce the problem.

3. *Provide an image or description of what part of the image is incorrect and how* so we can be sure we've reproduced the problem correctly.


================================================
FILE: .github/ISSUE_TEMPLATE/2-bug_report.md
================================================
---
name: Bug report
about: if you're having trouble using a library, try the support forum instead
title: ''
labels: ''
assignees: ''

---

**DO NOT USE AI TO WRITE THE BUG REPORT FOR YOU**  
Such issues will be closed. See bottom for explanation.

**Describe the bug**  
A clear and concise description of what the bug is.

**To Reproduce**  
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**  
A clear and concise description of what you expected to happen.

**Screenshots**  
If applicable, add screenshots to help explain your problem.

**AI BUG REPORTS**  
Using AI like LLMs just adds unnecessary additional verbiage that maintainers have to read and determine whether there is valuable and useful information. An AI by definition *cannot* add useful detail that was not in the original information you gathered. Just share the information you gathered. For example, it doesn't matter if your English isn't good.


================================================
FILE: .github/ISSUE_TEMPLATE/3-feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 4 enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: support forum
    url: https://github.com/nothings/stb/discussions/categories/q-a
    about: having trouble using an stb library? don't create an issue, post in the forum


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
* Delete this list before clicking CREATE PULL REQUEST
* Make sure you're using a special branch just for this pull request. (Sometimes people unknowingly use a default branch, then later update that branch, which updates the pull request with the other changes if it hasn't been merged yet.)
* Do NOT update the version number in the file. (This just causes conflicts.)
* Do add your name to the list of contributors. (Don't worry about the formatting.) I'll try to remember to add it if you don't, but I sometimes forget as it's an extra step.

If you get something above wrong, don't fret it, it's not the end of the world.


================================================
FILE: .github/workflows/ci-fuzz.yml
================================================
name: CIFuzz
on: [pull_request]
jobs:
  Fuzzing:
    runs-on: ubuntu-latest
    steps:
    - name: Build Fuzzers
      uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
      with:
        oss-fuzz-project-name: 'stb'
        dry-run: false
    - name: Run Fuzzers
      uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
      with:
        oss-fuzz-project-name: 'stb'
        fuzz-seconds: 900
        dry-run: false
    - name: Upload Crash
      uses: actions/upload-artifact@v1
      if: failure()
      with:
        name: artifacts
        path: ./out/artifacts


================================================
FILE: .gitignore
================================================
*.o
*.obj
*.exe


================================================
FILE: .travis.yml
================================================
language: C
arch:
  - AMD64
  - ppc64le
install: true
script:
  - cd tests
  - make all


================================================
FILE: CONTRIBUTING.md
================================================
AI AND LLM ARE FORBIDDEN
========================

This project doesn't accept code or documentation generated
by LLMs or any other forms of generative AI.

Please don't submit pull requests based on generative AI
output, and don't use AI auto completion when you write
pull requests.

Additionally, don't use LLMs to create pull requests or issues.
Write them yourself, in English, even if your English is bad.


Contributions Welcome
=====================

Pull Requests and Issues are both welcome.


### Responsiveness

General priority order is:

* Crashes
* Security issues in stb_image
* Bugs
* Security concerns in other libs
* Warnings
* Enhancements (new features, performance improvement, etc)

Pull requests get priority over Issues. Some pull requests I take
as written; some I modify myself; some I will request changes before
accepting them. Because I've ended up supporting a lot of libraries
(20 as I write this, with more on the way), I am somewhat slow to
address things. Many issues have been around for a long time.


### Pull requests

* Make sure you're using a special branch just for this pull request. (Sometimes people unknowingly use a default branch, then later update that branch, which updates the pull request with the other changes if it hasn't been merged yet.)
* Do NOT update the version number in the file. (This just causes conflicts.)
* Do add your name to the list of contributors. (Don't worry about the formatting.) I'll try to remember to add it if you don't, but I sometimes forget as it's an extra step.
* Your change needs to compile as both C and C++. Pre-C99 compilers should be supported (e.g. declare at start of block)


### Specific libraries

I generally do not want new file formats for stb_image because
we are trying to improve its security, so increasing its attack
surface is counter-productive.



================================================
FILE: LICENSE
================================================
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Sean Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: README.md
================================================
<!---   THIS FILE IS AUTOMATICALLY GENERATED, DO NOT CHANGE IT BY HAND   --->

stb
===

single-file public domain (or MIT licensed) libraries for C/C++

# This project discusses security-relevant bugs in public in Github Issues and Pull Requests, and it may take significant time for security fixes to be implemented or merged. If this poses an unreasonable risk to your project, do not use stb libraries.

Noteworthy:

* image loader: [stb_image.h](stb_image.h)
* image writer: [stb_image_write.h](stb_image_write.h)
* image resizer: [stb_image_resize2.h](stb_image_resize2.h)
* font text rasterizer: [stb_truetype.h](stb_truetype.h)
* typesafe containers: [stb_ds.h](stb_ds.h)

Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, original stb_image_resize
by Jorge L. "VinoBS" Rodriguez, and stb_image_resize2 and stb_sprintf by Jeff Roberts.

<a name="stb_libs"></a>

library    | latest version | category | LoC | description
--------------------- | ---- | -------- | --- | --------------------------------
**[stb_vorbis.c](stb_vorbis.c)** | 1.22 | audio | 5584 | decode ogg vorbis files from file/memory to float/16-bit signed output
**[stb_hexwave.h](stb_hexwave.h)** | 0.5 | audio | 680 | audio waveform synthesizer
**[stb_image.h](stb_image.h)** | 2.30 | graphics | 7988 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
**[stb_truetype.h](stb_truetype.h)** | 1.26 | graphics | 5079 | parse, decode, and rasterize characters from truetype fonts
**[stb_image_write.h](stb_image_write.h)** | 1.16 | graphics | 1724 | image writing to disk: PNG, TGA, BMP
**[stb_image_resize2.h](stb_image_resize2.h)** | 2.18b | graphics | 10679 | resize images larger/smaller with good quality
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.01 | graphics | 623 | simple 2D rectangle packer with decent quality
**[stb_perlin.h](stb_perlin.h)** | 0.5 | graphics | 428 | perlin's revised simplex noise w/ different seeds
**[stb_ds.h](stb_ds.h)** | 0.67 | utility | 1895 | typesafe dynamic array and hash tables for C, will compile in C++
**[stb_sprintf.h](stb_sprintf.h)** | 1.10 | utility | 1906 | fast sprintf, snprintf for C/C++
**[stb_textedit.h](stb_textedit.h)** | 1.14 | user&nbsp;interface | 1429 | guts of a text editor for games etc implementing them from scratch
**[stb_voxel_render.h](stb_voxel_render.h)** | 0.89 | 3D&nbsp;graphics | 3807 | Minecraft-esque voxel rendering "engine" with many more features
**[stb_dxt.h](stb_dxt.h)** | 1.12 | 3D&nbsp;graphics | 719 | Fabian "ryg" Giesen's real-time DXT compressor
**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D&nbsp;graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.42 | game&nbsp;dev | 4187 | embeddable tilemap editor
**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game&nbsp;dev | 1221 | herringbone Wang tile map generator
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.12 | parsing | 941 | simplify writing parsers for C-like languages
**[stb_divide.h](stb_divide.h)** | 0.94 | math | 433 | more useful 32-bit modulus e.g. "euclidean divide"
**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking
**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL

Total libraries: 21
Total lines of C code: 51166


FAQ
---

#### What's the license?

These libraries are in the public domain. You can do anything you
want with them. You have no legal obligation
to do anything else, although I appreciate attribution.

They are also licensed under the MIT open source license, if you have lawyers
who are unhappy with public domain. Every source file includes an explicit
dual-license for you to choose from.

#### How do I use these libraries?

The idea behind single-header file libraries is that they're easy to distribute and deploy
because all the code is contained in a single file. By default, the .h files in here act as
their own header files, i.e. they declare the functions contained in the file but don't
actually result in any code getting compiled.

So in addition, you should select _exactly one_ C/C++ source file that actually instantiates
the code, preferably a file you're not editing frequently. This file should define a
specific macro (this is documented per-library) to actually enable the function definitions.
For example, to use stb_image, you should have exactly one C/C++ file that doesn't
include stb_image.h regularly, but instead does

    #define STB_IMAGE_IMPLEMENTATION
    #include "stb_image.h"

The right macro to define is pointed out right at the top of each of these libraries.

#### <a name="other_libs"></a> Are there other single-file public-domain/open source libraries with minimal dependencies out there?

[Yes.](https://github.com/nothings/single_file_libs)

#### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?

No, because it's public domain you can freely relicense it to whatever license your new
library wants to be.

#### What's the deal with SSE support in GCC-based compilers?

stb_image will either use SSE2 (if you compile with -msse2) or
will not use any SIMD at all, rather than trying to detect the
processor at runtime and handle it correctly. As I understand it,
the approved path in GCC for runtime-detection require
you to use multiple source files, one for each CPU configuration.
Because stb_image is a header-file library that compiles in only
one source file, there's no approved way to build both an
SSE-enabled and a non-SSE-enabled variation.

While we've tried to work around it, we've had multiple issues over
the years due to specific versions of gcc breaking what we're doing,
so we've given up on it. See https://github.com/nothings/stb/issues/280
and https://github.com/nothings/stb/issues/410 for examples.

#### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?

Generally they're only better in that they're easier to integrate,
easier to use, and easier to release (single file; good API; no
attribution requirement). They may be less featureful, slower,
and/or use more memory. If you're already using an equivalent
library, there's probably no good reason to switch.

#### Can I link directly to the table of stb libraries?

You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.

#### Why do you list "lines of code"? It's a terrible metric.

Just to give you some idea of the internal complexity of the library,
to help you manage your expectations, or to let you know what you're
getting into. While not all the libraries are written in the same
style, they're certainly similar styles, and so comparisons between
the libraries are probably still meaningful.

Note though that the lines do include both the implementation, the
part that corresponds to a header file, and the documentation.

#### Why single-file headers?

Windows doesn't have standard directories where libraries
live. That makes deploying libraries in Windows a lot more
painful than open source developers on Unix-derivates generally
realize. (It also makes library dependencies a lot worse in Windows.)

There's also a common problem in Windows where a library was built
against a different version of the runtime library, which causes
link conflicts and confusion. Shipping the libs as headers means
you normally just compile them straight into your project without
making libraries, thus sidestepping that problem.

Making them a single file makes it very easy to just
drop them into a project that needs them. (Of course you can
still put them in a proper shared library tree if you want.)

Why not two files, one a header and one an implementation?
The difference between 10 files and 9 files is not a big deal,
but the difference between 2 files and 1 file is a big deal.
You don't need to zip or tar the files up, you don't have to
remember to attach *two* files, etc.

#### Why "stb"? Is this something to do with Set-Top Boxes?

No, they are just the initials for my name, Sean T. Barrett.
This was not chosen out of egomania, but as a moderately sane
way of namespacing the filenames and source function names.

#### Will you add more image types to stb_image.h?

No. As stb_image use has grown, it has become more important
for us to focus on security of the codebase. Adding new image
formats increases the amount of code we need to secure, so it
is no longer worth adding new formats.

#### Do you have any advice on how to create my own single-file library?

Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt

#### Why public domain?

I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.
Some of them are listed here:
https://github.com/nothings/stb/blob/master/docs/why_public_domain.md

#### Why C?

Primarily, because I use C, not C++. But it does also make it easier
for other people to use them from other languages.

#### Why not C99? stdint.h, declare-anywhere, etc.

I still use MSVC 6 (1998) as my IDE because it has better human factors
for me than later versions of MSVC.


================================================
FILE: SECURITY.md
================================================
# Security Policy
This project discusses security-relevant bugs in public in Github Issues and Pull Requests, and it may take significant time for security fixes to be implemented or merged. If this poses an unreasonable risk to your project, do not use stb libraries.


================================================
FILE: data/herringbone/license.txt
================================================
All files in this directory are in the public domain. Where
a public domain declaration is not recognized, you are granted
a license to freely use, modify, and redistribute them in
any way you choose.

================================================
FILE: deprecated/rrsprintf.h
================================================
#ifndef RR_SPRINTF_H_INCLUDE
#define RR_SPRINTF_H_INCLUDE

/*
Single file sprintf replacement.

Originally written by Jeff Roberts at RAD Game Tools - 2015/10/20. 
Hereby placed in public domain.

This is a full sprintf replacement that supports everything that
the C runtime sprintfs support, including float/double, 64-bit integers,
hex floats, field parameters (%*.*d stuff), length reads backs, etc.

Why would you need this if sprintf already exists?  Well, first off,
it's *much* faster (see below). It's also much smaller than the CRT
versions code-space-wise. We've also added some simple improvements 
that are super handy (commas in thousands, callbacks at buffer full,
for example). Finally, the format strings for MSVC and GCC differ 
for 64-bit integers (among other small things), so this lets you use 
the same format strings in cross platform code.

It uses the standard single file trick of being both the header file
and the source itself. If you just include it normally, you just get 
the header file function definitions. To get the code, you include
it from a C or C++ file and define RR_SPRINTF_IMPLEMENTATION first.

It only uses va_args macros from the C runtime to do it's work. It
does cast doubles to S64s and shifts and divides U64s, which does 
drag in CRT code on most platforms.

It compiles to roughly 8K with float support, and 4K without.
As a comparison, when using MSVC static libs, calling sprintf drags
in 16K.

API:
====
int rrsprintf( char * buf, char const * fmt, ... )
int rrsnprintf( char * buf, int count, char const * fmt, ... )
  Convert an arg list into a buffer.  rrsnprintf always returns
  a zero-terminated string (unlike regular snprintf).

int rrvsprintf( char * buf, char const * fmt, va_list va )
int rrvsnprintf( char * buf, int count, char const * fmt, va_list va )
  Convert a va_list arg list into a buffer.  rrvsnprintf always returns
  a zero-terminated string (unlike regular snprintf).

int rrvsprintfcb( RRSPRINTFCB * callback, void * user, char * buf, char const * fmt, va_list va )
    typedef char * RRSPRINTFCB( char const * buf, void * user, int len );
  Convert into a buffer, calling back every RR_SPRINTF_MIN chars.
  Your callback can then copy the chars out, print them or whatever.
  This function is actually the workhorse for everything else.
  The buffer you pass in must hold at least RR_SPRINTF_MIN characters.
    // you return the next buffer to use or 0 to stop converting

void rrsetseparators( char comma, char period )
  Set the comma and period characters to use.

FLOATS/DOUBLES:
===============
This code uses a internal float->ascii conversion method that uses
doubles with error correction (double-doubles, for ~105 bits of
precision).  This conversion is round-trip perfect - that is, an atof
of the values output here will give you the bit-exact double back.

One difference is that our insignificant digits will be different than 
with MSVC or GCC (but they don't match each other either).  We also 
don't attempt to find the minimum length matching float (pre-MSVC15 
doesn't either).

If you don't need float or doubles at all, define RR_SPRINTF_NOFLOAT
and you'll save 4K of code space.

64-BIT INTS:
============
This library also supports 64-bit integers and you can use MSVC style or
GCC style indicators (%I64d or %lld).  It supports the C99 specifiers
for size_t and ptr_diff_t (%jd %zd) as well.

EXTRAS:
=======
Like some GCCs, for integers and floats, you can use a ' (single quote)
specifier and commas will be inserted on the thousands: "%'d" on 12345 
would print 12,345.

For integers and floats, you can use a "$" specifier and the number 
will be converted to float and then divided to get kilo, mega, giga or
tera and then printed, so "%$d" 1024 is "1.0 k", "%$.2d" 2536000 is 
"2.42 m", etc.

In addition to octal and hexadecimal conversions, you can print 
integers in binary: "%b" for 256 would print 100.

PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC):
===================================================================
"%d" across all 32-bit ints (4.8x/4.0x faster than 32-/64-bit MSVC)
"%24d" across all 32-bit ints (4.5x/4.2x faster)
"%x" across all 32-bit ints (4.5x/3.8x faster)
"%08x" across all 32-bit ints (4.3x/3.8x faster)
"%f" across e-10 to e+10 floats (7.3x/6.0x faster)
"%e" across e-10 to e+10 floats (8.1x/6.0x faster)
"%g" across e-10 to e+10 floats (10.0x/7.1x faster)
"%f" for values near e-300 (7.9x/6.5x faster)
"%f" for values near e+300 (10.0x/9.1x faster)
"%e" for values near e-300 (10.1x/7.0x faster)
"%e" for values near e+300 (9.2x/6.0x faster)
"%.320f" for values near e-300 (12.6x/11.2x faster)
"%a" for random values (8.6x/4.3x faster)
"%I64d" for 64-bits with 32-bit values (4.8x/3.4x faster)
"%I64d" for 64-bits > 32-bit values (4.9x/5.5x faster)
"%s%s%s" for 64 char strings (7.1x/7.3x faster)
"...512 char string..." ( 35.0x/32.5x faster!)
*/

#ifdef RR_SPRINTF_STATIC
#define RRPUBLIC_DEC static
#define RRPUBLIC_DEF static
#else
#ifdef __cplusplus
#define RRPUBLIC_DEC extern "C"
#define RRPUBLIC_DEF extern "C"
#else
#define RRPUBLIC_DEC extern 
#define RRPUBLIC_DEF
#endif
#endif

#include <stdarg.h>  // for va_list()

#ifndef RR_SPRINTF_MIN
#define RR_SPRINTF_MIN 512 // how many characters per callback
#endif
typedef char * RRSPRINTFCB( char * buf, void * user, int len );

#ifndef RR_SPRINTF_DECORATE
#define RR_SPRINTF_DECORATE(name) rr##name  // define this before including if you want to change the names
#endif

#ifndef RR_SPRINTF_IMPLEMENTATION

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintf )( char * buf, char const * fmt, va_list va );
RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, char const * fmt, va_list va );
RRPUBLIC_DEF int RR_SPRINTF_DECORATE( sprintf ) ( char * buf, char const * fmt, ... );
RRPUBLIC_DEF int RR_SPRINTF_DECORATE( snprintf )( char * buf, int count, char const * fmt, ... );

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintfcb )( RRSPRINTFCB * callback, void * user, char * buf, char const * fmt, va_list va );
RRPUBLIC_DEF void RR_SPRINTF_DECORATE( setseparators )( char comma, char period );

#else

#include <stdlib.h>  // for va_arg()

#define rU32 unsigned int
#define rS32 signed int

#ifdef _MSC_VER
#define rU64 unsigned __int64
#define rS64 signed __int64
#else
#define rU64 unsigned long long
#define rS64 signed long long
#endif
#define rU16 unsigned short

#ifndef rUINTa 
#if defined(__ppc64__) || defined(__aarch64__) || defined(_M_X64) || defined(__x86_64__) || defined(__x86_64)
#define rUINTa rU64
#else
#define rUINTa rU32
#endif
#endif

#ifndef RR_SPRINTF_MSVC_MODE  // used for MSVC2013 and earlier (MSVC2015 matches GCC)
#if defined(_MSC_VER) && (_MSC_VER<1900)
#define RR_SPRINTF_MSVC_MODE
#endif
#endif

#ifdef RR_SPRINTF_NOUNALIGNED  // define this before inclusion to force rrsprint to always use aligned accesses
#define RR_UNALIGNED(code)
#else
#define RR_UNALIGNED(code) code
#endif

#ifndef RR_SPRINTF_NOFLOAT
// internal float utility functions
static rS32 rrreal_to_str( char const * * start, rU32 * len, char *out, rS32 * decimal_pos, double value, rU32 frac_digits );
static rS32 rrreal_to_parts( rS64 * bits, rS32 * expo, double value );
#define RRSPECIAL 0x7000
#endif

static char RRperiod='.';
static char RRcomma=',';
static char rrdiglookup[201]="00010203040506070809101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899";

RRPUBLIC_DEF void RR_SPRINTF_DECORATE( setseparators )( char pcomma, char pperiod )
{
  RRperiod=pperiod;
  RRcomma=pcomma;
}

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintfcb )( RRSPRINTFCB * callback, void * user, char * buf, char const * fmt, va_list va )
{
  static char hex[]="0123456789abcdefxp";
  static char hexu[]="0123456789ABCDEFXP";
  char * bf;
  char const * f;
  int tlen = 0;

  bf = buf;
  f = fmt;
  for(;;)
  {
    rS32 fw,pr,tz; rU32 fl;

    #define LJ 1
    #define LP 2
    #define LS 4
    #define LX 8
    #define LZ 16
    #define BI 32
    #define CS 64
    #define NG 128
    #define KI 256
    #define HW 512
 
    // macros for the callback buffer stuff
    #define chk_cb_bufL(bytes) { int len = (int)(bf-buf); if ((len+(bytes))>=RR_SPRINTF_MIN) { tlen+=len; if (0==(bf=buf=callback(buf,user,len))) goto done; } }
    #define chk_cb_buf(bytes) { if ( callback ) { chk_cb_bufL(bytes); } }
    #define flush_cb() { chk_cb_bufL(RR_SPRINTF_MIN-1); } //flush if there is even one byte in the buffer
    #define cb_buf_clamp(cl,v) cl = v; if ( callback ) { int lg = RR_SPRINTF_MIN-(int)(bf-buf); if (cl>lg) cl=lg; }

    // fast copy everything up to the next % (or end of string)
    for(;;)
    { 
      while (((rUINTa)f)&3)
      {
       schk1: if (f[0]=='%') goto scandd;
       schk2: if (f[0]==0) goto endfmt;
        chk_cb_buf(1); *bf++=f[0]; ++f;
      } 
      for(;;)
      { 
        rU32 v,c;
        v=*(rU32*)f; c=(~v)&0x80808080;
        if ((v-0x26262626)&c) goto schk1; 
        if ((v-0x01010101)&c) goto schk2; 
        if (callback) if ((RR_SPRINTF_MIN-(int)(bf-buf))<4) goto schk1;
        *(rU32*)bf=v; bf+=4; f+=4;
      }
    } scandd:

    ++f;

    // ok, we have a percent, read the modifiers first
    fw = 0; pr = -1; fl = 0; tz = 0;
    
    // flags
    for(;;)
    {
      switch(f[0])
      {
        // if we have left just
        case '-': fl|=LJ; ++f; continue;
        // if we have leading plus
        case '+': fl|=LP; ++f; continue; 
        // if we have leading space
        case ' ': fl|=LS; ++f; continue; 
        // if we have leading 0x
        case '#': fl|=LX; ++f; continue; 
        // if we have thousand commas
        case '\'': fl|=CS; ++f; continue; 
        // if we have kilo marker
        case '$': fl|=KI; ++f; continue; 
        // if we have leading zero
        case '0': fl|=LZ; ++f; goto flags_done; 
        default: goto flags_done;
      }
    }
    flags_done:
   
    // get the field width
    if ( f[0] == '*' ) {fw = va_arg(va,rU32); ++f;} else { while (( f[0] >= '0' ) && ( f[0] <= '9' )) { fw = fw * 10 + f[0] - '0'; f++; } }
    // get the precision
    if ( f[0]=='.' ) { ++f; if ( f[0] == '*' ) {pr = va_arg(va,rU32); ++f;} else { pr = 0; while (( f[0] >= '0' ) && ( f[0] <= '9' )) { pr = pr * 10 + f[0] - '0'; f++; } } } 
    
    // handle integer size overrides
    switch(f[0])
    {
      // are we halfwidth?
      case 'h': fl|=HW; ++f; break;
      // are we 64-bit (unix style)
      case 'l': ++f; if ( f[0]=='l') { fl|=BI; ++f; } break;
      // are we 64-bit on intmax? (c99)
      case 'j': fl|=BI; ++f; break; 
      // are we 64-bit on size_t or ptrdiff_t? (c99)
      case 'z': case 't': fl|=((sizeof(char*)==8)?BI:0); ++f; break; 
      // are we 64-bit (msft style)
      case 'I': if ( ( f[1]=='6') && ( f[2]=='4') ) { fl|=BI; f+=3; } else if ( ( f[1]=='3') && ( f[2]=='2') ) { f+=3; } else { fl|=((sizeof(void*)==8)?BI:0); ++f; } break;
      default: break;
    }

    // handle each replacement
    switch( f[0] )
    {
      #define NUMSZ 512 // big enough for e308 (with commas) or e-307 
      char num[NUMSZ]; 
      char lead[8]; 
      char tail[8]; 
      char *s;
      char const *h;
      rU32 l,n,cs;
      rU64 n64;
      #ifndef RR_SPRINTF_NOFLOAT      
      double fv; 
      #endif
      rS32 dp; char const * sn;

      case 's':
        // get the string
        s = va_arg(va,char*); if (s==0) s = (char*)"null";
        // get the length
        sn = s;
        for(;;)
        { 
          if ((((rUINTa)sn)&3)==0) break;
         lchk:
          if (sn[0]==0) goto ld;
          ++sn;
        }
        n = 0xffffffff;
        if (pr>=0) { n=(rU32)(sn-s); if (n>=(rU32)pr) goto ld; n=((rU32)(pr-n))>>2; }
        while(n) 
        { 
          rU32 v=*(rU32*)sn;
          if ((v-0x01010101)&(~v)&0x80808080UL) goto lchk; 
          sn+=4; 
          --n;
        }
        goto lchk;
       ld:

        l = (rU32) ( sn - s );
        // clamp to precision
        if ( l > (rU32)pr ) l = pr;
        lead[0]=0; tail[0]=0; pr = 0; dp = 0; cs = 0;
        // copy the string in
        goto scopy;

      case 'c': // char
        // get the character
        s = num + NUMSZ -1; *s = (char)va_arg(va,int);
        l = 1;
        lead[0]=0; tail[0]=0; pr = 0; dp = 0; cs = 0;
        goto scopy;

      case 'n': // weird write-bytes specifier
        { int * d = va_arg(va,int*);
        *d = tlen + (int)( bf - buf ); }
        break;

#ifdef RR_SPRINTF_NOFLOAT
      case 'A': // float
      case 'a': // hex float
      case 'G': // float
      case 'g': // float
      case 'E': // float
      case 'e': // float
      case 'f': // float
        va_arg(va,double); // eat it
        s = (char*)"No float";
        l = 8;
        lead[0]=0; tail[0]=0; pr = 0; dp = 0; cs = 0;
        goto scopy;
#else
      case 'A': // float
        h=hexu;  
        goto hexfloat;

      case 'a': // hex float
        h=hex;
       hexfloat: 
        fv = va_arg(va,double);
        if (pr==-1) pr=6; // default is 6
        // read the double into a string
        if ( rrreal_to_parts( (rS64*)&n64, &dp, fv ) )
          fl |= NG;
  
        s = num+64;

        // sign
        lead[0]=0; if (fl&NG) { lead[0]=1; lead[1]='-'; } else if (fl&LS) { lead[0]=1; lead[1]=' '; } else if (fl&LP) { lead[0]=1; lead[1]='+'; };

        if (dp==-1023) dp=(n64)?-1022:0; else n64|=(((rU64)1)<<52);
        n64<<=(64-56);
        if (pr<15) n64+=((((rU64)8)<<56)>>(pr*4));
        // add leading chars
        
        #ifdef RR_SPRINTF_MSVC_MODE
        *s++='0';*s++='x';
        #else
        lead[1+lead[0]]='0'; lead[2+lead[0]]='x'; lead[0]+=2;
        #endif
        *s++=h[(n64>>60)&15]; n64<<=4;
        if ( pr ) *s++=RRperiod;
        sn = s;

        // print the bits
        n = pr; if (n>13) n = 13; if (pr>(rS32)n) tz=pr-n; pr = 0;
        while(n--) { *s++=h[(n64>>60)&15]; n64<<=4; }

        // print the expo
        tail[1]=h[17];
        if (dp<0) { tail[2]='-'; dp=-dp;} else tail[2]='+';
        n = (dp>=1000)?6:((dp>=100)?5:((dp>=10)?4:3));
        tail[0]=(char)n;
        for(;;) { tail[n]='0'+dp%10; if (n<=3) break; --n; dp/=10; }

        dp = (int)(s-sn);
        l = (int)(s-(num+64));
        s = num+64;
        cs = 1 + (3<<24);
        goto scopy;

      case 'G': // float
        h=hexu;
        goto dosmallfloat;

      case 'g': // float
        h=hex;
       dosmallfloat:   
        fv = va_arg(va,double);
        if (pr==-1) pr=6; else if (pr==0) pr = 1; // default is 6
        // read the double into a string
        if ( rrreal_to_str( &sn, &l, num, &dp, fv, (pr-1)|0x80000000 ) )
          fl |= NG;

        // clamp the precision and delete extra zeros after clamp
        n = pr;
        if ( l > (rU32)pr ) l = pr; while ((l>1)&&(pr)&&(sn[l-1]=='0')) { --pr; --l; }

        // should we use %e
        if ((dp<=-4)||(dp>(rS32)n))
        {
          if ( pr > (rS32)l ) pr = l-1; else if ( pr ) --pr; // when using %e, there is one digit before the decimal
          goto doexpfromg;
        }
        // this is the insane action to get the pr to match %g sematics for %f
        if(dp>0) { pr=(dp<(rS32)l)?l-dp:0; } else { pr = -dp+((pr>(rS32)l)?l:pr); }
        goto dofloatfromg;

      case 'E': // float
        h=hexu;  
        goto doexp;

      case 'e': // float
        h=hex;
       doexp:   
        fv = va_arg(va,double);
        if (pr==-1) pr=6; // default is 6
        // read the double into a string
        if ( rrreal_to_str( &sn, &l, num, &dp, fv, pr|0x80000000 ) )
          fl |= NG;
       doexpfromg: 
        tail[0]=0; 
        lead[0]=0; if (fl&NG) { lead[0]=1; lead[1]='-'; } else if (fl&LS) { lead[0]=1; lead[1]=' '; } else if (fl&LP) { lead[0]=1; lead[1]='+'; };
        if ( dp == RRSPECIAL ) { s=(char*)sn; cs=0; pr=0; goto scopy; }
        s=num+64; 
        // handle leading chars
        *s++=sn[0];

        if (pr) *s++=RRperiod;

        // handle after decimal
        if ((l-1)>(rU32)pr) l=pr+1;
        for(n=1;n<l;n++) *s++=sn[n];
        // trailing zeros
        tz = pr-(l-1); pr=0;
        // dump expo
        tail[1]=h[0xe];
        dp -= 1;
        if (dp<0) { tail[2]='-'; dp=-dp;} else tail[2]='+';
        #ifdef RR_SPRINTF_MSVC_MODE
        n = 5;
        #else
        n = (dp>=100)?5:4;
        #endif
        tail[0]=(char)n;
        for(;;) { tail[n]='0'+dp%10; if (n<=3) break; --n; dp/=10; }
        cs = 1 + (3<<24); // how many tens
        goto flt_lead;   

      case 'f': // float
        fv = va_arg(va,double);
       doafloat: 
        // do kilos
        if (fl&KI) {while(fl<0x4000000) { if ((fv<1024.0) && (fv>-1024.0)) break; fv/=1024.0; fl+=0x1000000; }} 
        if (pr==-1) pr=6; // default is 6
        // read the double into a string
        if ( rrreal_to_str( &sn, &l, num, &dp, fv, pr ) )
          fl |= NG;
        dofloatfromg:
        tail[0]=0;
        // sign
        lead[0]=0; if (fl&NG) { lead[0]=1; lead[1]='-'; } else if (fl&LS) { lead[0]=1; lead[1]=' '; } else if (fl&LP) { lead[0]=1; lead[1]='+'; };
        if ( dp == RRSPECIAL ) { s=(char*)sn; cs=0; pr=0; goto scopy; }
        s=num+64; 

        // handle the three decimal varieties
        if (dp<=0) 
        { 
          rS32 i;
          // handle 0.000*000xxxx
          *s++='0'; if (pr) *s++=RRperiod; 
          n=-dp; if((rS32)n>pr) n=pr; i=n; while(i) { if ((((rUINTa)s)&3)==0) break; *s++='0'; --i; } while(i>=4) { *(rU32*)s=0x30303030; s+=4; i-=4; } while(i) { *s++='0'; --i; }
          if ((rS32)(l+n)>pr) l=pr-n; i=l; while(i) { *s++=*sn++; --i; }
          tz = pr-(n+l);
          cs = 1 + (3<<24); // how many tens did we write (for commas below)
        }
        else
        {
          cs = (fl&CS)?((600-(rU32)dp)%3):0;
          if ((rU32)dp>=l)
          {
            // handle xxxx000*000.0
            n=0; for(;;) { if ((fl&CS) && (++cs==4)) { cs = 0; *s++=RRcomma; } else { *s++=sn[n]; ++n; if (n>=l) break; } }
            if (n<(rU32)dp)
            {
              n = dp - n;
              if ((fl&CS)==0) { while(n) { if ((((rUINTa)s)&3)==0) break; *s++='0'; --n; }  while(n>=4) { *(rU32*)s=0x30303030; s+=4; n-=4; } }
              while(n) { if ((fl&CS) && (++cs==4)) { cs = 0; *s++=RRcomma; } else { *s++='0'; --n; } }
            }
            cs = (int)(s-(num+64)) + (3<<24); // cs is how many tens
            if (pr) { *s++=RRperiod; tz=pr;}
          }
          else
          {
            // handle xxxxx.xxxx000*000
            n=0; for(;;) { if ((fl&CS) && (++cs==4)) { cs = 0; *s++=RRcomma; } else { *s++=sn[n]; ++n; if (n>=(rU32)dp) break; } }
            cs = (int)(s-(num+64)) + (3<<24); // cs is how many tens
            if (pr) *s++=RRperiod;
            if ((l-dp)>(rU32)pr) l=pr+dp;
            while(n<l) { *s++=sn[n]; ++n; }
            tz = pr-(l-dp);
          }
        }
        pr = 0;
        
        // handle k,m,g,t
        if (fl&KI) { tail[0]=1; tail[1]=' '; { if (fl>>24) { tail[2]="_kmgt"[fl>>24]; tail[0]=2; } } };

        flt_lead:
        // get the length that we copied
        l = (rU32) ( s-(num+64) );
        s=num+64; 
        goto scopy;
#endif

      case 'B': // upper binary
        h = hexu;
        goto binary;

      case 'b': // lower binary
        h = hex;
        binary:
        lead[0]=0;
        if (fl&LX) { lead[0]=2;lead[1]='0';lead[2]=h[0xb]; }
        l=(8<<4)|(1<<8);
        goto radixnum;

      case 'o': // octal
        h = hexu;
        lead[0]=0;
        if (fl&LX) { lead[0]=1;lead[1]='0'; }
        l=(3<<4)|(3<<8);
        goto radixnum;

      case 'p': // pointer
        fl |= (sizeof(void*)==8)?BI:0;
        pr = sizeof(void*)*2;
        fl &= ~LZ; // 'p' only prints the pointer with zeros
        // drop through to X
      
      case 'X': // upper binary
        h = hexu;
        goto dohexb;

      case 'x': // lower binary
        h = hex; dohexb:
        l=(4<<4)|(4<<8);
        lead[0]=0;
        if (fl&LX) { lead[0]=2;lead[1]='0';lead[2]=h[16]; }
       radixnum: 
        // get the number
        if ( fl&BI )
          n64 = va_arg(va,rU64);
        else
          n64 = va_arg(va,rU32);

        s = num + NUMSZ; dp = 0;
        // clear tail, and clear leading if value is zero
        tail[0]=0; if (n64==0) { lead[0]=0; if (pr==0) { l=0; cs = ( ((l>>4)&15)) << 24; goto scopy; } }
        // convert to string
        for(;;) { *--s = h[n64&((1<<(l>>8))-1)]; n64>>=(l>>8); if ( ! ( (n64) || ((rS32) ( (num+NUMSZ) - s ) < pr ) ) ) break; if ( fl&CS) { ++l; if ((l&15)==((l>>4)&15)) { l&=~15; *--s=RRcomma; } } };
        // get the tens and the comma pos
        cs = (rU32) ( (num+NUMSZ) - s ) + ( ( ((l>>4)&15)) << 24 );
        // get the length that we copied
        l = (rU32) ( (num+NUMSZ) - s );
        // copy it
        goto scopy;

      case 'u': // unsigned
      case 'i':
      case 'd': // integer
        // get the integer and abs it
        if ( fl&BI )
        {
          rS64 i64 = va_arg(va,rS64); n64 = (rU64)i64; if ((f[0]!='u') && (i64<0)) { n64=(rU64)-i64; fl|=NG; }
        }
        else
        {
          rS32 i = va_arg(va,rS32); n64 = (rU32)i; if ((f[0]!='u') && (i<0)) { n64=(rU32)-i; fl|=NG; }
        }

        #ifndef RR_SPRINTF_NOFLOAT
        if (fl&KI) { if (n64<1024) pr=0; else if (pr==-1) pr=1; fv=(double)(rS64)n64; goto doafloat; } 
        #endif

        // convert to string
        s = num+NUMSZ; l=0; 
        
        for(;;)
        {
          // do in 32-bit chunks (avoid lots of 64-bit divides even with constant denominators)
          char * o=s-8;
          if (n64>=100000000) { n = (rU32)( n64 % 100000000);  n64 /= 100000000; } else {n = (rU32)n64; n64 = 0; }
          if((fl&CS)==0) { while(n) { s-=2; *(rU16*)s=*(rU16*)&rrdiglookup[(n%100)*2]; n/=100; } }
          while (n) { if ( ( fl&CS) && (l++==3) ) { l=0; *--s=RRcomma; --o; } else { *--s=(char)(n%10)+'0'; n/=10; } }
          if (n64==0) { if ((s[0]=='0') && (s!=(num+NUMSZ))) ++s; break; }
          while (s!=o) if ( ( fl&CS) && (l++==3) ) { l=0; *--s=RRcomma; --o; } else { *--s='0'; }
        }

        tail[0]=0;
        // sign
        lead[0]=0; if (fl&NG) { lead[0]=1; lead[1]='-'; } else if (fl&LS) { lead[0]=1; lead[1]=' '; } else if (fl&LP) { lead[0]=1; lead[1]='+'; };

        // get the length that we copied
        l = (rU32) ( (num+NUMSZ) - s ); if ( l == 0 ) { *--s='0'; l = 1; }
        cs = l + (3<<24);
        if (pr<0) pr = 0;

       scopy: 
        // get fw=leading/trailing space, pr=leading zeros
        if (pr<(rS32)l) pr = l;
        n = pr + lead[0] + tail[0] + tz;
        if (fw<(rS32)n) fw = n;
        fw -= n;
        pr -= l;

        // handle right justify and leading zeros
        if ( (fl&LJ)==0 )
        {
          if (fl&LZ) // if leading zeros, everything is in pr
          { 
            pr = (fw>pr)?fw:pr;
            fw = 0;
          }
          else
          {
            fl &= ~CS; // if no leading zeros, then no commas
          }
        }

        // copy the spaces and/or zeros
        if (fw+pr)
        {
          rS32 i; rU32 c; 

          // copy leading spaces (or when doing %8.4d stuff)
          if ( (fl&LJ)==0 ) while(fw>0) { cb_buf_clamp(i,fw); fw -= i; while(i) { if ((((rUINTa)bf)&3)==0) break; *bf++=' '; --i; } while(i>=4) { *(rU32*)bf=0x20202020; bf+=4; i-=4; } while (i) {*bf++=' '; --i;} chk_cb_buf(1); }
        
          // copy leader
          sn=lead+1; while(lead[0]) { cb_buf_clamp(i,lead[0]); lead[0] -= (char)i; while (i) {*bf++=*sn++; --i;} chk_cb_buf(1); }
          
          // copy leading zeros
          c = cs >> 24; cs &= 0xffffff;
          cs = (fl&CS)?((rU32)(c-((pr+cs)%(c+1)))):0;
          while(pr>0) { cb_buf_clamp(i,pr); pr -= i; if((fl&CS)==0) { while(i) { if ((((rUINTa)bf)&3)==0) break; *bf++='0'; --i; } while(i>=4) { *(rU32*)bf=0x30303030; bf+=4; i-=4; } } while (i) { if((fl&CS) && (cs++==c)) { cs = 0; *bf++=RRcomma; } else *bf++='0'; --i; } chk_cb_buf(1); }
        }

        // copy leader if there is still one
        sn=lead+1; while(lead[0]) { rS32 i; cb_buf_clamp(i,lead[0]); lead[0] -= (char)i; while (i) {*bf++=*sn++; --i;} chk_cb_buf(1); }

        // copy the string
        n = l; while (n) { rS32 i; cb_buf_clamp(i,n); n-=i; RR_UNALIGNED( while(i>=4) { *(rU32*)bf=*(rU32*)s; bf+=4; s+=4; i-=4; } ) while (i) {*bf++=*s++; --i;} chk_cb_buf(1); }

        // copy trailing zeros
        while(tz) { rS32 i; cb_buf_clamp(i,tz); tz -= i; while(i) { if ((((rUINTa)bf)&3)==0) break; *bf++='0'; --i; } while(i>=4) { *(rU32*)bf=0x30303030; bf+=4; i-=4; } while (i) {*bf++='0'; --i;} chk_cb_buf(1); }

        // copy tail if there is one
        sn=tail+1; while(tail[0]) { rS32 i; cb_buf_clamp(i,tail[0]); tail[0] -= (char)i; while (i) {*bf++=*sn++; --i;} chk_cb_buf(1); }

        // handle the left justify
        if (fl&LJ) if (fw>0) { while (fw) { rS32 i; cb_buf_clamp(i,fw); fw-=i; while(i) { if ((((rUINTa)bf)&3)==0) break; *bf++=' '; --i; } while(i>=4) { *(rU32*)bf=0x20202020; bf+=4; i-=4; } while (i--) *bf++=' '; chk_cb_buf(1); } }
        break;

      default: // unknown, just copy code
        s = num + NUMSZ -1; *s = f[0];
        l = 1;
        fw=pr=fl=0;
        lead[0]=0; tail[0]=0; pr = 0; dp = 0; cs = 0;
        goto scopy;
    }
    ++f;
  }
 endfmt:

  if (!callback) 
    *bf = 0;
  else
    flush_cb();
 
 done:
  return tlen + (int)(bf-buf);
}

// cleanup
#undef LJ
#undef LP
#undef LS
#undef LX
#undef LZ
#undef BI
#undef CS
#undef NG
#undef KI
#undef NUMSZ
#undef chk_cb_bufL
#undef chk_cb_buf
#undef flush_cb
#undef cb_buf_clamp

// ============================================================================
//   wrapper functions

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( sprintf )( char * buf, char const * fmt, ... )
{
  va_list va;
  va_start( va, fmt );
  return RR_SPRINTF_DECORATE( vsprintfcb )( 0, 0, buf, fmt, va );
}

typedef struct RRCCS
{
  char * buf;
  int count;
  char tmp[ RR_SPRINTF_MIN ];
} RRCCS;

static char * rrclampcallback( char * buf, void * user, int len )
{
  RRCCS * c = (RRCCS*)user;

  if ( len > c->count ) len = c->count;

  if (len)
  {
    if ( buf != c->buf )
    {
      char * s, * d, * se;
      d = c->buf; s = buf; se = buf+len;
      do{ *d++ = *s++; } while (s<se);
    }
    c->buf += len;
    c->count -= len;
  }
  
  if ( c->count <= 0 ) return 0;
  return ( c->count >= RR_SPRINTF_MIN ) ? c->buf : c->tmp; // go direct into buffer if you can
}

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, char const * fmt, va_list va )
{
  RRCCS c;
  int l;

  if ( count == 0 )
    return 0;

  c.buf = buf;
  c.count = count;

  RR_SPRINTF_DECORATE( vsprintfcb )( rrclampcallback, &c, rrclampcallback(0,&c,0), fmt, va );
  
  // zero-terminate
  l = (int)( c.buf - buf );
  if ( l >= count ) // should never be greater, only equal (or less) than count
    l = count - 1;
  buf[l] = 0;

  return l;
}

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( snprintf )( char * buf, int count, char const * fmt, ... )
{
  va_list va;
  va_start( va, fmt );

  return RR_SPRINTF_DECORATE( vsnprintf )( buf, count, fmt, va );
}

RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintf )( char * buf, char const * fmt, va_list va )
{
  return RR_SPRINTF_DECORATE( vsprintfcb )( 0, 0, buf, fmt, va );
}

// =======================================================================
//   low level float utility functions

#ifndef RR_SPRINTF_NOFLOAT

 // copies d to bits w/ strict aliasing (this compiles to nothing on /Ox)
 #define RRCOPYFP(dest,src) { int cn; for(cn=0;cn<8;cn++) ((char*)&dest)[cn]=((char*)&src)[cn]; }
 
// get float info
static rS32 rrreal_to_parts( rS64 * bits, rS32 * expo, double value )
{
  double d;
  rS64 b = 0;

  // load value and round at the frac_digits
  d = value;

  RRCOPYFP( b, d );

  *bits = b & ((((rU64)1)<<52)-1);
  *expo = ((b >> 52) & 2047)-1023;
    
  return (rS32)(b >> 63);
}

static double const rrbot[23]={1e+000,1e+001,1e+002,1e+003,1e+004,1e+005,1e+006,1e+007,1e+008,1e+009,1e+010,1e+011,1e+012,1e+013,1e+014,1e+015,1e+016,1e+017,1e+018,1e+019,1e+020,1e+021,1e+022};
static double const rrnegbot[22]={1e-001,1e-002,1e-003,1e-004,1e-005,1e-006,1e-007,1e-008,1e-009,1e-010,1e-011,1e-012,1e-013,1e-014,1e-015,1e-016,1e-017,1e-018,1e-019,1e-020,1e-021,1e-022};
static double const rrnegboterr[22]={-5.551115123125783e-018,-2.0816681711721684e-019,-2.0816681711721686e-020,-4.7921736023859299e-021,-8.1803053914031305e-022,4.5251888174113741e-023,4.5251888174113739e-024,-2.0922560830128471e-025,-6.2281591457779853e-026,-3.6432197315497743e-027,6.0503030718060191e-028,2.0113352370744385e-029,-3.0373745563400371e-030,1.1806906454401013e-032,-7.7705399876661076e-032,2.0902213275965398e-033,-7.1542424054621921e-034,-7.1542424054621926e-035,2.4754073164739869e-036,5.4846728545790429e-037,9.2462547772103625e-038,-4.8596774326570872e-039};
static double const rrtop[13]={1e+023,1e+046,1e+069,1e+092,1e+115,1e+138,1e+161,1e+184,1e+207,1e+230,1e+253,1e+276,1e+299};
static double const rrnegtop[13]={1e-023,1e-046,1e-069,1e-092,1e-115,1e-138,1e-161,1e-184,1e-207,1e-230,1e-253,1e-276,1e-299};
static double const rrtoperr[13]={8388608,6.8601809640529717e+028,-7.253143638152921e+052,-4.3377296974619174e+075,-1.5559416129466825e+098,-3.2841562489204913e+121,-3.7745893248228135e+144,-1.7356668416969134e+167,-3.8893577551088374e+190,-9.9566444326005119e+213,6.3641293062232429e+236,-5.2069140800249813e+259,-5.2504760255204387e+282};
static double const rrnegtoperr[13]={3.9565301985100693e-040,-2.299904345391321e-063,3.6506201437945798e-086,1.1875228833981544e-109,-5.0644902316928607e-132,-6.7156837247865426e-155,-2.812077463003139e-178,-5.7778912386589953e-201,7.4997100559334532e-224,-4.6439668915134491e-247,-6.3691100762962136e-270,-9.436808465446358e-293,8.0970921678014997e-317};

#if defined(_MSC_VER) && (_MSC_VER<=1200)                                                                                                                                                                                       
static rU64 const rrpot[20]={1,10,100,1000, 10000,100000,1000000,10000000, 100000000,1000000000,10000000000,100000000000,  1000000000000,10000000000000,100000000000000,1000000000000000,  10000000000000000,100000000000000000,1000000000000000000,10000000000000000000U };
#define rrtento19th ((rU64)1000000000000000000)
#else
static rU64 const rrpot[20]={1,10,100,1000, 10000,100000,1000000,10000000, 100000000,1000000000,10000000000ULL,100000000000ULL,  1000000000000ULL,10000000000000ULL,100000000000000ULL,1000000000000000ULL,  10000000000000000ULL,100000000000000000ULL,1000000000000000000ULL,10000000000000000000ULL };
#define rrtento19th (1000000000000000000ULL)
#endif

#define rrddmulthi(oh,ol,xh,yh) \
{ \
  double ahi=0,alo,bhi=0,blo; \
  rS64 bt; \
  oh = xh * yh; \
  RRCOPYFP(bt,xh); bt&=((~(rU64)0)<<27); RRCOPYFP(ahi,bt); alo = xh-ahi; \
  RRCOPYFP(bt,yh); bt&=((~(rU64)0)<<27); RRCOPYFP(bhi,bt); blo = yh-bhi; \
  ol = ((ahi*bhi-oh)+ahi*blo+alo*bhi)+alo*blo; \
}

#define rrddtoS64(ob,xh,xl) \
{ \
  double ahi=0,alo,vh,t;\
  ob = (rS64)ph;\
  vh=(double)ob;\
  ahi = ( xh - vh );\
  t = ( ahi - xh );\
  alo = (xh-(ahi-t))-(vh+t);\
  ob += (rS64)(ahi+alo+xl);\
}


#define rrddrenorm(oh,ol) { double s; s=oh+ol; ol=ol-(s-oh); oh=s; }

#define rrddmultlo(oh,ol,xh,xl,yh,yl) \
  ol = ol + ( xh*yl + xl*yh ); \

#define rrddmultlos(oh,ol,xh,yl) \
  ol = ol + ( xh*yl ); \

static void rrraise_to_power10( double *ohi, double *olo, double d, rS32 power )  // power can be -323 to +350
{
  double ph, pl;
  if ((power>=0) && (power<=22))
  {
    rrddmulthi(ph,pl,d,rrbot[power]);
  }
  else
  {
    rS32 e,et,eb;
    double p2h,p2l;

    e=power; if (power<0) e=-e; 
    et = (e*0x2c9)>>14;/* %23 */ if (et>13) et=13; eb = e-(et*23);

    ph = d; pl = 0.0;
    if (power<0)
    {
      if (eb) { --eb; rrddmulthi(ph,pl,d,rrnegbot[eb]); rrddmultlos(ph,pl,d,rrnegboterr[eb]); }
      if (et)
      { 
        rrddrenorm(ph,pl);
        --et; rrddmulthi(p2h,p2l,ph,rrnegtop[et]); rrddmultlo(p2h,p2l,ph,pl,rrnegtop[et],rrnegtoperr[et]); ph=p2h;pl=p2l;
      }
    }
    else
    {
      if (eb) 
      { 
        e = eb; if (eb>22) eb=22; e -= eb;
        rrddmulthi(ph,pl,d,rrbot[eb]); 
        if ( e ) { rrddrenorm(ph,pl); rrddmulthi(p2h,p2l,ph,rrbot[e]); rrddmultlos(p2h,p2l,rrbot[e],pl); ph=p2h;pl=p2l; }
      }
      if (et)
      {
        rrddrenorm(ph,pl);
        --et; rrddmulthi(p2h,p2l,ph,rrtop[et]); rrddmultlo(p2h,p2l,ph,pl,rrtop[et],rrtoperr[et]); ph=p2h;pl=p2l;
      }
    }
  }
  rrddrenorm(ph,pl);
  *ohi = ph; *olo = pl;
}

// given a float value, returns the significant bits in bits, and the position of the
//   decimal point in decimal_pos.  +/-INF and NAN are specified by special values
//   returned in the decimal_pos parameter.
// frac_digits is absolute normally, but if you want from first significant digits (got %g and %e), or in 0x80000000
static rS32 rrreal_to_str( char const * * start, rU32 * len, char *out, rS32 * decimal_pos, double value, rU32 frac_digits )
{
  double d;
  rS64 bits = 0;
  rS32 expo, e, ng, tens;

  d = value;
  RRCOPYFP(bits,d);
  expo = (bits >> 52) & 2047;
  ng = (rS32)(bits >> 63);
  if (ng) d=-d;

  if ( expo == 2047 ) // is nan or inf?
  {
    *start = (bits&((((rU64)1)<<52)-1)) ? "NaN" : "Inf";
    *decimal_pos =  RRSPECIAL;
    *len = 3;
    return ng;
  } 

  if ( expo == 0 ) // is zero or denormal
  {
    if ((bits<<1)==0) // do zero
    {
      *decimal_pos = 1; 
      *start = out;
      out[0] = '0'; *len = 1;
      return ng;
    }
    // find the right expo for denormals
    {
      rS64 v = ((rU64)1)<<51;
      while ((bits&v)==0) { --expo; v >>= 1; }
    }
  }

  // find the decimal exponent as well as the decimal bits of the value
  {
    double ph,pl;

    // log10 estimate - very specifically tweaked to hit or undershoot by no more than 1 of log10 of all expos 1..2046
    tens=expo-1023; tens = (tens<0)?((tens*617)/2048):(((tens*1233)/4096)+1);

    // move the significant bits into position and stick them into an int 
    rrraise_to_power10( &ph, &pl, d, 18-tens );

    // get full as much precision from double-double as possible
    rrddtoS64( bits, ph,pl );

    // check if we undershot
    if ( ((rU64)bits) >= rrtento19th ) ++tens; 
  }

  // now do the rounding in integer land
  frac_digits = ( frac_digits & 0x80000000 ) ? ( (frac_digits&0x7ffffff) + 1 ) : ( tens + frac_digits );
  if ( ( frac_digits < 24 ) )
  {
    rU32 dg = 1; if ((rU64)bits >= rrpot[9] ) dg=10; while( (rU64)bits >= rrpot[dg] ) { ++dg; if (dg==20) goto noround; }
    if ( frac_digits < dg )
    {
      rU64 r;
      // add 0.5 at the right position and round
      e = dg - frac_digits;
      if ( (rU32)e >= 24 ) goto noround;
      r = rrpot[e];
      bits = bits + (r/2);
      if ( (rU64)bits >= rrpot[dg] ) ++tens;
      bits /= r;
    } 
    noround:;
  }

  // kill long trailing runs of zeros
  if ( bits )
  {
    rU32 n; for(;;) { if ( bits<=0xffffffff ) break; if (bits%1000) goto donez; bits/=1000; } n = (rU32)bits; while ((n%1000)==0) n/=1000; bits=n; donez:;
  }

  // convert to string
  out += 64;
  e = 0; 
  for(;;)
  {
    rU32 n;
    char * o = out-8;
    // do the conversion in chunks of U32s (avoid most 64-bit divides, worth it, constant denomiators be damned)
    if (bits>=100000000) { n = (rU32)( bits % 100000000);  bits /= 100000000; } else {n = (rU32)bits; bits = 0; }
    while(n) { out-=2; *(rU16*)out=*(rU16*)&rrdiglookup[(n%100)*2]; n/=100; e+=2; }
    if (bits==0) { if ((e) && (out[0]=='0')) { ++out; --e; } break; }
    while( out!=o ) { *--out ='0'; ++e; }
  }
  
  *decimal_pos = tens;
  *start = out;
  *len = e;
  return ng;
}

#undef rrddmulthi
#undef rrddrenorm
#undef rrddmultlo
#undef rrddmultlos
#undef RRSPECIAL 
#undef RRCOPYFP
 
#endif

// clean up
#undef rU16
#undef rU32 
#undef rS32 
#undef rU64
#undef rS64
#undef RRPUBLIC_DEC
#undef RRPUBLIC_DEF
#undef RR_SPRINTF_DECORATE
#undef RR_UNALIGNED

#endif

#endif


================================================
FILE: deprecated/stb.h
================================================
/* stb.h - v2.37 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h
          no warranty is offered or implied; use this code at your own risk

   This is a single header file with a bunch of useful utilities
   for getting stuff done in C/C++.

   Documentation: http://nothings.org/stb/stb_h.html
   Unit tests:    http://nothings.org/stb/stb.c

 ============================================================================
   You MUST

      #define STB_DEFINE

   in EXACTLY _one_ C or C++ file that includes this header, BEFORE the
   include, like this:

      #define STB_DEFINE
      #include "stb.h"

   All other files should just #include "stb.h" without the #define.
 ============================================================================

Version History

   2.36   various fixes
   2.35   fix clang-cl issues with swprintf
   2.34   fix warnings
   2.33   more fixes to random numbers
   2.32   stb_intcmprev, stb_uidict, fix random numbers on Linux
   2.31   stb_ucharcmp
   2.30   MinGW fix
   2.29   attempt to fix use of swprintf()
   2.28   various new functionality
   2.27   test _WIN32 not WIN32 in STB_THREADS
   2.26   various warning & bugfixes
   2.25   various warning & bugfixes
   2.24   various warning & bugfixes
   2.23   fix 2.22
   2.22   64-bit fixes from '!='; fix stb_sdict_copy() to have preferred name
   2.21   utf-8 decoder rejects "overlong" encodings; attempted 64-bit improvements
   2.20   fix to hash "copy" function--reported by someone with handle "!="
   2.19   ???
   2.18   stb_readdir_subdirs_mask
   2.17   stb_cfg_dir
   2.16   fix stb_bgio_, add stb_bgio_stat(); begin a streaming wrapper
   2.15   upgraded hash table template to allow:
            - aggregate keys (explicit comparison func for EMPTY and DEL keys)
            - "static" implementations (so they can be culled if unused)
   2.14   stb_mprintf
   2.13   reduce identifiable strings in STB_NO_STB_STRINGS
   2.12   fix STB_ONLY -- lots of uint32s, TRUE/FALSE things had crept in
   2.11   fix bug in stb_dirtree_get() which caused "c://path" sorts of stuff
   2.10   STB_F(), STB_I() inline constants (also KI,KU,KF,KD)
   2.09   stb_box_face_vertex_axis_side
   2.08   bugfix stb_trimwhite()
   2.07   colored printing in windows (why are we in 1985?)
   2.06   comparison functions are now functions-that-return-functions and
          accept a struct-offset as a parameter (not thread-safe)
   2.05   compile and pass tests under Linux (but no threads); thread cleanup
   2.04   stb_cubic_bezier_1d, smoothstep, avoid dependency on registry
   2.03   ?
   2.02   remove integrated documentation
   2.01   integrate various fixes; stb_force_uniprocessor
   2.00   revised stb_dupe to use multiple hashes
   1.99   stb_charcmp
   1.98   stb_arr_deleten, stb_arr_insertn
   1.97   fix stb_newell_normal()
   1.96   stb_hash_number()
   1.95   hack stb__rec_max; clean up recursion code to use new functions
   1.94   stb_dirtree; rename stb_extra to stb_ptrmap
   1.93   stb_sem_new() API cleanup (no blockflag-starts blocked; use 'extra')
   1.92   stb_threadqueue--multi reader/writer queue, fixed size or resizeable
   1.91   stb_bgio_* for reading disk asynchronously
   1.90   stb_mutex uses CRITICAL_REGION; new stb_sync primitive for thread
          joining; workqueue supports stb_sync instead of stb_semaphore
   1.89   support ';' in constant-string wildcards; stb_mutex wrapper (can
          implement with EnterCriticalRegion eventually)
   1.88   portable threading API (only for win32 so far); worker thread queue
   1.87   fix wildcard handling in stb_readdir_recursive
   1.86   support ';' in wildcards
   1.85   make stb_regex work with non-constant strings;
               beginnings of stb_introspect()
   1.84   (forgot to make notes)
   1.83   whoops, stb_keep_if_different wasn't deleting the temp file
   1.82   bring back stb_compress from stb_file.h for cmirror
   1.81   various bugfixes, STB_FASTMALLOC_INIT inits FASTMALLOC in release
   1.80   stb_readdir returns utf8; write own utf8-utf16 because lib was wrong
   1.79   stb_write
   1.78   calloc() support for malloc wrapper, STB_FASTMALLOC
   1.77   STB_FASTMALLOC
   1.76   STB_STUA - Lua-like language; (stb_image, stb_csample, stb_bilinear)
   1.75   alloc/free array of blocks; stb_hheap bug; a few stb_ps_ funcs;
          hash*getkey, hash*copy; stb_bitset; stb_strnicmp; bugfix stb_bst
   1.74   stb_replaceinplace; use stdlib C function to convert utf8 to UTF-16
   1.73   fix performance bug & leak in stb_ischar (C++ port lost a 'static')
   1.72   remove stb_block, stb_block_manager, stb_decompress (to stb_file.h)
   1.71   stb_trimwhite, stb_tokens_nested, etc.
   1.70   back out 1.69 because it might problemize mixed builds; stb_filec()
   1.69   (stb_file returns 'char *' in C++)
   1.68   add a special 'tree root' data type for stb_bst; stb_arr_end
   1.67   full C++ port. (stb_block_manager)
   1.66   stb_newell_normal
   1.65   stb_lex_item_wild -- allow wildcard items which MUST match entirely
   1.64   stb_data
   1.63   stb_log_name
   1.62   stb_define_sort; C++ cleanup
   1.61   stb_hash_fast -- Paul Hsieh's hash function (beats Bob Jenkins'?)
   1.60   stb_delete_directory_recursive
   1.59   stb_readdir_recursive
   1.58   stb_bst variant with parent pointer for O(1) iteration, not O(log N)
   1.57   replace LCG random with Mersenne Twister (found a public domain one)
   1.56   stb_perfect_hash, stb_ischar, stb_regex
   1.55   new stb_bst API allows multiple BSTs per node (e.g. secondary keys)
   1.54   bugfix: stb_define_hash, stb_wildmatch, regexp
   1.53   stb_define_hash; recoded stb_extra, stb_sdict use it
   1.52   stb_rand_define, stb_bst, stb_reverse
   1.51   fix 'stb_arr_setlen(NULL, 0)'
   1.50   stb_wordwrap
   1.49   minor improvements to enable the scripting language
   1.48   better approach for stb_arr using stb_malloc; more invasive, clearer
   1.47   stb_lex (lexes stb.h at 1.5ML/s on 3Ghz P4; 60/70% of optimal/flex)
   1.46   stb_wrapper_*, STB_MALLOC_WRAPPER
   1.45   lightly tested DFA acceleration of regexp searching
   1.44   wildcard matching & searching; regexp matching & searching
   1.43   stb_temp
   1.42   allow stb_arr to use stb_malloc/realloc; note this is global
   1.41   make it compile in C++; (disable stb_arr in C++)
   1.40   stb_dupe tweak; stb_swap; stb_substr
   1.39   stb_dupe; improve stb_file_max to be less stupid
   1.38   stb_sha1_file: generate sha1 for file, even > 4GB
   1.37   stb_file_max; partial support for utf8 filenames in Windows
   1.36   remove STB__NO_PREFIX - poor interaction with IDE, not worth it
          streamline stb_arr to make it separately publishable
   1.35   bugfixes for stb_sdict, stb_malloc(0), stristr
   1.34   (streaming interfaces for stb_compress)
   1.33   stb_alloc; bug in stb_getopt; remove stb_overflow
   1.32   (stb_compress returns, smaller&faster; encode window & 64-bit len)
   1.31   stb_prefix_count
   1.30   (STB__NO_PREFIX - remove stb_ prefixes for personal projects)
   1.29   stb_fput_varlen64, etc.
   1.28   stb_sha1
   1.27   ?
   1.26   stb_extra
   1.25   ?
   1.24   stb_copyfile
   1.23   stb_readdir
   1.22   ?
   1.21   ?
   1.20   ?
   1.19   ?
   1.18   ?
   1.17   ?
   1.16   ?
   1.15   stb_fixpath, stb_splitpath, stb_strchr2
   1.14   stb_arr
   1.13   ?stb, stb_log, stb_fatal
   1.12   ?stb_hash2
   1.11   miniML
   1.10   stb_crc32, stb_adler32
   1.09   stb_sdict
   1.08   stb_bitreverse, stb_ispow2, stb_big32
          stb_fopen, stb_fput_varlen, stb_fput_ranged
          stb_fcmp, stb_feq
   1.07   (stb_encompress)
   1.06   stb_compress
   1.05   stb_tokens, (stb_hheap)
   1.04   stb_rand
   1.03   ?(s-strings)
   1.02   ?stb_filelen, stb_tokens
   1.01   stb_tolower
   1.00   stb_hash, stb_intcmp
          stb_file, stb_stringfile, stb_fgets
          stb_prefix, stb_strlower, stb_strtok
          stb_image
          (stb_array), (stb_arena)

Parenthesized items have since been removed.

LICENSE

 See end of file for license information.

CREDITS

 Written by Sean Barrett.

 Fixes:
  Philipp Wiesemann
  Robert Nix
  r-lyeh
  blackpawn
  github:Mojofreem
  Ryan Whitworth
  Vincent Isambart
  Mike Sartain
  Eugene Opalev
  Tim Sjostrand
  github:infatum
  Dave Butler (Croepha)
  Ethan Lee (flibitijibibo)
  Brian Collins
  Kyle Langley
*/

#include <stdarg.h>

#ifndef STB__INCLUDE_STB_H
#define STB__INCLUDE_STB_H

#define STB_VERSION  1

#ifdef STB_INTROSPECT
   #define STB_DEFINE
#endif

#ifdef STB_DEFINE_THREADS
   #ifndef STB_DEFINE
   #define STB_DEFINE
   #endif
   #ifndef STB_THREADS
   #define STB_THREADS
   #endif
#endif

#if defined(_WIN32) && !defined(__MINGW32__)
   #ifndef _CRT_SECURE_NO_WARNINGS
   #define _CRT_SECURE_NO_WARNINGS
   #endif
   #ifndef _CRT_NONSTDC_NO_DEPRECATE
   #define _CRT_NONSTDC_NO_DEPRECATE
   #endif
   #ifndef _CRT_NON_CONFORMING_SWPRINTFS
   #define _CRT_NON_CONFORMING_SWPRINTFS
   #endif
   #if !defined(_MSC_VER) || _MSC_VER > 1700
   #include <intrin.h> // _BitScanReverse
   #endif
#endif

#include <stdlib.h>     // stdlib could have min/max
#include <stdio.h>      // need FILE
#include <string.h>     // stb_define_hash needs memcpy/memset
#include <time.h>       // stb_dirtree
#ifdef __MINGW32__
   #include <fcntl.h>   // O_RDWR
#endif

#ifdef STB_PERSONAL
   typedef int Bool;
   #define False 0
   #define True 1
#endif

#ifdef STB_MALLOC_WRAPPER_PAGED
   #define STB_MALLOC_WRAPPER_DEBUG
#endif
#ifdef STB_MALLOC_WRAPPER_DEBUG
   #define STB_MALLOC_WRAPPER
#endif
#ifdef STB_MALLOC_WRAPPER_FASTMALLOC
   #define STB_FASTMALLOC
   #define STB_MALLOC_WRAPPER
#endif

#ifdef STB_FASTMALLOC
   #ifndef _WIN32
      #undef STB_FASTMALLOC
   #endif
#endif

#ifdef STB_DEFINE
   #include <assert.h>
   #include <stdarg.h>
   #include <stddef.h>
   #include <ctype.h>
   #include <math.h>
   #ifndef _WIN32
   #include <unistd.h>
   #else
   #include <io.h>      // _mktemp
   #include <direct.h>  // _rmdir
   #endif
   #include <sys/types.h> // stat()/_stat()
   #include <sys/stat.h>  // stat()/_stat()
#endif

#define stb_min(a,b)   ((a) < (b) ? (a) : (b))
#define stb_max(a,b)   ((a) > (b) ? (a) : (b))

#ifndef STB_ONLY
   #if !defined(__cplusplus) && !defined(min) && !defined(max)
     #define min(x,y) stb_min(x,y)
     #define max(x,y) stb_max(x,y)
   #endif

   #ifndef M_PI
     #define M_PI  3.14159265358979323846f
   #endif

   #ifndef TRUE
     #define TRUE  1
     #define FALSE 0
   #endif

   #ifndef deg2rad
   #define deg2rad(a)  ((a)*(M_PI/180))
   #endif
   #ifndef rad2deg
   #define rad2deg(a)  ((a)*(180/M_PI))
   #endif

   #ifndef swap
   #ifndef __cplusplus
   #define swap(TYPE,a,b)  \
               do { TYPE stb__t; stb__t = (a); (a) = (b); (b) = stb__t; } while (0)
   #endif
   #endif

   typedef unsigned char  uint8 ;
   typedef   signed char   int8 ;
   typedef unsigned short uint16;
   typedef   signed short  int16;
  #if defined(STB_USE_LONG_FOR_32_BIT_INT) || defined(STB_LONG32)
   typedef unsigned long  uint32;
   typedef   signed long   int32;
  #else
   typedef unsigned int   uint32;
   typedef   signed int    int32;
  #endif

   typedef unsigned char  uchar ;
   typedef unsigned short ushort;
   typedef unsigned int   uint  ;
   typedef unsigned long  ulong ;

   // produce compile errors if the sizes aren't right
   typedef char stb__testsize16[sizeof(int16)==2];
   typedef char stb__testsize32[sizeof(int32)==4];
#endif

#ifndef STB_TRUE
  #define STB_TRUE 1
  #define STB_FALSE 0
#endif

// if we're STB_ONLY, can't rely on uint32 or even uint, so all the
// variables we'll use herein need typenames prefixed with 'stb':
typedef unsigned char stb_uchar;
typedef unsigned char stb_uint8;
typedef unsigned int  stb_uint;
typedef unsigned short stb_uint16;
typedef          short stb_int16;
typedef   signed char  stb_int8;
#if defined(STB_USE_LONG_FOR_32_BIT_INT) || defined(STB_LONG32)
  typedef unsigned long  stb_uint32;
  typedef          long  stb_int32;
#else
  typedef unsigned int   stb_uint32;
  typedef          int   stb_int32;
#endif
typedef char stb__testsize2_16[sizeof(stb_uint16)==2 ? 1 : -1];
typedef char stb__testsize2_32[sizeof(stb_uint32)==4 ? 1 : -1];

#ifdef _MSC_VER
  typedef unsigned __int64 stb_uint64;
  typedef          __int64 stb_int64;
  #define STB_IMM_UINT64(literalui64) (literalui64##ui64)
  #define STB_IMM_INT64(literali64) (literali64##i64)
#else
  // ??
  typedef unsigned long long stb_uint64;
  typedef          long long stb_int64;
  #define STB_IMM_UINT64(literalui64) (literalui64##ULL)
  #define STB_IMM_INT64(literali64) (literali64##LL)
#endif
typedef char stb__testsize2_64[sizeof(stb_uint64)==8 ? 1 : -1];

// add platform-specific ways of checking for sizeof(char*) == 8,
// and make those define STB_PTR64
#if defined(_WIN64) || defined(__x86_64__) || defined(__ia64__) || defined(__LP64__)
  #define STB_PTR64
#endif

#ifdef STB_PTR64
typedef char stb__testsize2_ptr[sizeof(char *) == 8];
typedef stb_uint64 stb_uinta;
typedef stb_int64  stb_inta;
#else
typedef char stb__testsize2_ptr[sizeof(char *) == 4];
typedef stb_uint32 stb_uinta;
typedef stb_int32  stb_inta;
#endif
typedef char stb__testsize2_uinta[sizeof(stb_uinta)==sizeof(char*) ? 1 : -1];

// if so, we should define an int type that is the pointer size. until then,
// we'll have to make do with this (which is not the same at all!)

typedef union
{
   unsigned int i;
   void * p;
} stb_uintptr;


#ifdef __cplusplus
   #define STB_EXTERN   extern "C"
#else
   #define STB_EXTERN   extern
#endif

// check for well-known debug defines
#if defined(DEBUG) || defined(_DEBUG) || defined(DBG)
   #ifndef NDEBUG
      #define STB_DEBUG
   #endif
#endif

#ifdef STB_DEBUG
   #include <assert.h>
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                         C library function platform handling
//

#ifdef STB_DEFINE

#if defined(_WIN32) &&  defined(__STDC_WANT_SECURE_LIB__)
static FILE * stb_p_fopen(const char *filename, const char *mode)
{
   FILE *f;
   if (0 == fopen_s(&f, filename, mode))
      return f;
   else
      return NULL;
}
static FILE * stb_p_wfopen(const wchar_t *filename, const wchar_t *mode)
{
   FILE *f;
   if (0 == _wfopen_s(&f, filename, mode))
      return f;
   else
      return NULL;
}
static char *stb_p_strcpy_s(char *a, size_t size, const char *b)
{
   strcpy_s(a,size,b);
   return a;
}
static char *stb_p_strncpy_s(char *a, size_t size, const char *b, size_t count)
{
   strncpy_s(a,size,b,count);
   return a;
}
#define stb_p_mktemp(s)  (_mktemp_s(s, strlen(s)+1) == 0)
#define stb_p_sprintf    sprintf_s
#define stb_p_size(x)    ,(x)
#else
#define stb_p_fopen      fopen
#define stb_p_wfopen     _wfopen
#define stb_p_strcpy_s(a,s,b)     strcpy(a,b)
#define stb_p_strncpy_s(a,s,b,c)  strncpy(a,b,c)
#define stb_p_mktemp(s)  (mktemp(s) != NULL)

#define stb_p_sprintf    sprintf
#define stb_p_size(x)
#endif

#if defined(_WIN32)
#define stb_p_vsnprintf  _vsnprintf
#else
#define stb_p_vsnprintf  vsnprintf
#endif
#endif // STB_DEFINE

#if defined(_WIN32) && (_MSC_VER >= 1300)
#define stb_p_stricmp    _stricmp
#define stb_p_strnicmp   _strnicmp
#define stb_p_strdup     _strdup
#else
#define stb_p_strdup     strdup
#define stb_p_stricmp    stricmp
#define stb_p_strnicmp   strnicmp
#endif

STB_EXTERN void stb_wrapper_malloc(void *newp, size_t sz, char *file, int line);
STB_EXTERN void stb_wrapper_free(void *oldp, char *file, int line);
STB_EXTERN void stb_wrapper_realloc(void *oldp, void *newp, size_t sz, char *file, int line);
STB_EXTERN void stb_wrapper_calloc(size_t num, size_t sz, char *file, int line);
STB_EXTERN void stb_wrapper_listall(void (*func)(void *ptr, size_t sz, char *file, int line));
STB_EXTERN void stb_wrapper_dump(char *filename);
STB_EXTERN size_t stb_wrapper_allocsize(void *oldp);
STB_EXTERN void stb_wrapper_check(void *oldp);

#ifdef STB_DEFINE
// this is a special function used inside malloc wrapper
// to do allocations that aren't tracked (to avoid
// reentrancy). Of course if someone _else_ wraps realloc,
// this breaks, but if they're doing that AND the malloc
// wrapper they need to explicitly check for reentrancy.
//
// only define realloc_raw() and we do realloc(NULL,sz)
// for malloc() and realloc(p,0) for free().
static void * stb__realloc_raw(void *p, int sz)
{
   if (p == NULL) return malloc(sz);
   if (sz == 0)   { free(p); return NULL; }
   return realloc(p,sz);
}
#endif

#ifdef _WIN32
STB_EXTERN void * stb_smalloc(size_t sz);
STB_EXTERN void   stb_sfree(void *p);
STB_EXTERN void * stb_srealloc(void *p, size_t sz);
STB_EXTERN void * stb_scalloc(size_t n, size_t sz);
STB_EXTERN char * stb_sstrdup(char *s);
#endif

#ifdef STB_FASTMALLOC
#define malloc  stb_smalloc
#define free    stb_sfree
#define realloc stb_srealloc
#define strdup  stb_sstrdup
#define calloc  stb_scalloc
#endif

#ifndef STB_MALLOC_ALLCHECK
   #define stb__check(p)  1
#else
   #ifndef STB_MALLOC_WRAPPER
      #error STB_MALLOC_ALLCHECK requires STB_MALLOC_WRAPPER
   #else
      #define stb__check(p) stb_mcheck(p)
   #endif
#endif

#ifdef STB_MALLOC_WRAPPER
   STB_EXTERN void * stb__malloc(size_t, char *, int);
   STB_EXTERN void * stb__realloc(void *, size_t, char *, int);
   STB_EXTERN void * stb__calloc(size_t n, size_t s, char *, int);
   STB_EXTERN void   stb__free(void *, char *file, int);
   STB_EXTERN char * stb__strdup(char *s, char *file, int);
   STB_EXTERN void   stb_malloc_checkall(void);
   STB_EXTERN void   stb_malloc_check_counter(int init_delay, int rep_delay);
   #ifndef STB_MALLOC_WRAPPER_DEBUG
      #define stb_mcheck(p) 1
   #else
      STB_EXTERN int   stb_mcheck(void *);
   #endif


   #ifdef STB_DEFINE

   #ifdef STB_MALLOC_WRAPPER_DEBUG
      #define STB__PAD   32
      #define STB__BIAS  16
      #define STB__SIG   0x51b01234
      #define STB__FIXSIZE(sz)  (((sz+3) & ~3) + STB__PAD)
      #define STB__ptr(x,y)   ((char *) (x) + (y))
   #else
      #define STB__ptr(x,y)   (x)
      #define STB__FIXSIZE(sz)  (sz)
   #endif

   #ifdef STB_MALLOC_WRAPPER_DEBUG
   int stb_mcheck(void *p)
   {
      unsigned int sz;
      if (p == NULL) return 1;
      p = ((char *) p) - STB__BIAS;
      sz = * (unsigned int *) p;
      assert(* (unsigned int *) STB__ptr(p,4) == STB__SIG);
      assert(* (unsigned int *) STB__ptr(p,8) == STB__SIG);
      assert(* (unsigned int *) STB__ptr(p,12) == STB__SIG);
      assert(* (unsigned int *) STB__ptr(p,sz-4) == STB__SIG+1);
      assert(* (unsigned int *) STB__ptr(p,sz-8) == STB__SIG+1);
      assert(* (unsigned int *) STB__ptr(p,sz-12) == STB__SIG+1);
      assert(* (unsigned int *) STB__ptr(p,sz-16) == STB__SIG+1);
      stb_wrapper_check(STB__ptr(p, STB__BIAS));
      return 1;
   }

   static void stb__check2(void *p, size_t sz, char *file, int line)
   {
      stb_mcheck(p);
   }

   void stb_malloc_checkall(void)
   {
      stb_wrapper_listall(stb__check2);
   }
   #else
   void stb_malloc_checkall(void) { }
   #endif

   static int stb__malloc_wait=(1 << 30), stb__malloc_next_wait = (1 << 30), stb__malloc_iter;
   void stb_malloc_check_counter(int init_delay, int rep_delay)
   {
      stb__malloc_wait = init_delay;
      stb__malloc_next_wait = rep_delay;
   }

   void stb_mcheck_all(void)
   {
      #ifdef STB_MALLOC_WRAPPER_DEBUG
      ++stb__malloc_iter;
      if (--stb__malloc_wait <= 0) {
         stb_malloc_checkall();
         stb__malloc_wait = stb__malloc_next_wait;
      }
      #endif
   }

   #ifdef STB_MALLOC_WRAPPER_PAGED
   #define STB__WINDOWS_PAGE (1 << 12)
   #ifndef _WINDOWS_
   STB_EXTERN __declspec(dllimport) void * __stdcall VirtualAlloc(void *p, unsigned long size, unsigned long type, unsigned long protect);
   STB_EXTERN __declspec(dllimport) int   __stdcall VirtualFree(void *p, unsigned long size, unsigned long freetype);
   #endif
   #endif

   static void *stb__malloc_final(size_t sz)
   {
      #ifdef STB_MALLOC_WRAPPER_PAGED
      size_t aligned = (sz + STB__WINDOWS_PAGE - 1) & ~(STB__WINDOWS_PAGE-1);
      char *p = VirtualAlloc(NULL, aligned + STB__WINDOWS_PAGE, 0x2000, 0x04); // RESERVE, READWRITE
      if (p == NULL) return p;
      VirtualAlloc(p, aligned,   0x1000, 0x04); // COMMIT, READWRITE
      return p;
      #else
      return malloc(sz);
      #endif
   }

   static void stb__free_final(void *p)
   {
      #ifdef STB_MALLOC_WRAPPER_PAGED
      VirtualFree(p, 0, 0x8000); // RELEASE
      #else
      free(p);
      #endif
   }

   int stb__malloc_failure;
   #ifdef STB_MALLOC_WRAPPER_PAGED
   static void *stb__realloc_final(void *p, size_t sz, size_t old_sz)
   {
      void *q = stb__malloc_final(sz);
      if (q == NULL)
          return ++stb__malloc_failure, q;
      // @TODO: deal with p being smaller!
      memcpy(q, p, sz < old_sz ? sz : old_sz);
      stb__free_final(p);
      return q;
   }
   #endif

   void stb__free(void *p, char *file, int line)
   {
      stb_mcheck_all();
      if (!p) return;
      #ifdef STB_MALLOC_WRAPPER_DEBUG
      stb_mcheck(p);
      #endif
      stb_wrapper_free(p,file,line);
      #ifdef STB_MALLOC_WRAPPER_DEBUG
         p = STB__ptr(p,-STB__BIAS);
         * (unsigned int *) STB__ptr(p,0) = 0xdeadbeef;
         * (unsigned int *) STB__ptr(p,4) = 0xdeadbeef;
         * (unsigned int *) STB__ptr(p,8) = 0xdeadbeef;
         * (unsigned int *) STB__ptr(p,12) = 0xdeadbeef;
      #endif
      stb__free_final(p);
   }

   void * stb__malloc(size_t sz, char *file, int line)
   {
      void *p;
      stb_mcheck_all();
      if (sz == 0) return NULL;
      p = stb__malloc_final(STB__FIXSIZE(sz));
      if (p == NULL) p = stb__malloc_final(STB__FIXSIZE(sz));
      if (p == NULL) p = stb__malloc_final(STB__FIXSIZE(sz));
      if (p == NULL) {
         ++stb__malloc_failure;
         #ifdef STB_MALLOC_WRAPPER_DEBUG
         stb_malloc_checkall();
         #endif
         return p;
      }
      #ifdef STB_MALLOC_WRAPPER_DEBUG
      * (int *) STB__ptr(p,0) = STB__FIXSIZE(sz);
      * (unsigned int *) STB__ptr(p,4) = STB__SIG;
      * (unsigned int *) STB__ptr(p,8) = STB__SIG;
      * (unsigned int *) STB__ptr(p,12) = STB__SIG;
      * (unsigned int *) STB__ptr(p,STB__FIXSIZE(sz)-4) = STB__SIG+1;
      * (unsigned int *) STB__ptr(p,STB__FIXSIZE(sz)-8) = STB__SIG+1;
      * (unsigned int *) STB__ptr(p,STB__FIXSIZE(sz)-12) = STB__SIG+1;
      * (unsigned int *) STB__ptr(p,STB__FIXSIZE(sz)-16) = STB__SIG+1;
      p = STB__ptr(p, STB__BIAS);
      #endif
      stb_wrapper_malloc(p,sz,file,line);
      return p;
   }

   void * stb__realloc(void *p, size_t sz, char *file, int line)
   {
      void *q;

      stb_mcheck_all();
      if (p == NULL) return stb__malloc(sz,file,line);
      if (sz == 0  ) { stb__free(p,file,line); return NULL; }

      #ifdef STB_MALLOC_WRAPPER_DEBUG
         stb_mcheck(p);
         p = STB__ptr(p,-STB__BIAS);
      #endif
      #ifdef STB_MALLOC_WRAPPER_PAGED
      {
         size_t n = stb_wrapper_allocsize(STB__ptr(p,STB__BIAS));
         if (!n)
            stb_wrapper_check(STB__ptr(p,STB__BIAS));
         q = stb__realloc_final(p, STB__FIXSIZE(sz), STB__FIXSIZE(n));
      }
      #else
      q = realloc(p, STB__FIXSIZE(sz));
      #endif
      if (q == NULL)
         return ++stb__malloc_failure, q;
      #ifdef STB_MALLOC_WRAPPER_DEBUG
      * (int *) STB__ptr(q,0) = STB__FIXSIZE(sz);
      * (unsigned int *) STB__ptr(q,4) = STB__SIG;
      * (unsigned int *) STB__ptr(q,8) = STB__SIG;
      * (unsigned int *) STB__ptr(q,12) = STB__SIG;
      * (unsigned int *) STB__ptr(q,STB__FIXSIZE(sz)-4) = STB__SIG+1;
      * (unsigned int *) STB__ptr(q,STB__FIXSIZE(sz)-8) = STB__SIG+1;
      * (unsigned int *) STB__ptr(q,STB__FIXSIZE(sz)-12) = STB__SIG+1;
      * (unsigned int *) STB__ptr(q,STB__FIXSIZE(sz)-16) = STB__SIG+1;

      q = STB__ptr(q, STB__BIAS);
      p = STB__ptr(p, STB__BIAS);
      #endif
      stb_wrapper_realloc(p,q,sz,file,line);
      return q;
   }

   STB_EXTERN int stb_log2_ceil(size_t);
   static void *stb__calloc(size_t n, size_t sz, char *file, int line)
   {
      void *q;
      stb_mcheck_all();
      if (n == 0 || sz == 0) return NULL;
      if (stb_log2_ceil(n) + stb_log2_ceil(sz) >= 32) return NULL;
      q = stb__malloc(n*sz, file, line);
      if (q) memset(q, 0, n*sz);
      return q;
   }

   char * stb__strdup(char *s, char *file, int line)
   {
      char *p;
      stb_mcheck_all();
      p = stb__malloc(strlen(s)+1, file, line);
      if (!p) return p;
      stb_p_strcpy_s(p, strlen(s)+1, s);
      return p;
   }
   #endif // STB_DEFINE

   #ifdef STB_FASTMALLOC
   #undef malloc
   #undef realloc
   #undef free
   #undef strdup
   #undef calloc
   #endif

   // include everything that might define these, BEFORE making macros
   #include <stdlib.h>
   #include <string.h>
   #include <malloc.h>

   #define malloc(s)      stb__malloc (  s, __FILE__, __LINE__)
   #define realloc(p,s)   stb__realloc(p,s, __FILE__, __LINE__)
   #define calloc(n,s)    stb__calloc (n,s, __FILE__, __LINE__)
   #define free(p)        stb__free   (p,   __FILE__, __LINE__)
   #define strdup(p)      stb__strdup (p,   __FILE__, __LINE__)
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                         Windows pretty display
//

STB_EXTERN void stbprint(const char *fmt, ...);
STB_EXTERN char *stb_sprintf(const char *fmt, ...);
STB_EXTERN char *stb_mprintf(const char *fmt, ...);
STB_EXTERN int  stb_snprintf(char *s, size_t n, const char *fmt, ...);
STB_EXTERN int  stb_vsnprintf(char *s, size_t n, const char *fmt, va_list v);

#ifdef STB_DEFINE
int stb_vsnprintf(char *s, size_t n, const char *fmt, va_list v)
{
   int res;
   #ifdef _WIN32
      #ifdef __STDC_WANT_SECURE_LIB__
      res = _vsnprintf_s(s, n, _TRUNCATE, fmt, v);
      #else
      res = stb_p_vsnprintf(s,n,fmt,v);
      #endif
   #else
   res = vsnprintf(s,n,fmt,v);
   #endif
   if (n) s[n-1] = 0;
   // Unix returns length output would require, Windows returns negative when truncated.
   return (res >= (int) n || res < 0) ? -1 : res;
}

int stb_snprintf(char *s, size_t n, const char *fmt, ...)
{
   int res;
   va_list v;
   va_start(v,fmt);
   res = stb_vsnprintf(s, n, fmt, v);
   va_end(v);
   return res;
}

char *stb_sprintf(const char *fmt, ...)
{
   static char buffer[1024];
   va_list v;
   va_start(v,fmt);
   stb_vsnprintf(buffer,1024,fmt,v);
   va_end(v);
   return buffer;
}

char *stb_mprintf(const char *fmt, ...)
{
   static char buffer[1024];
   va_list v;
   va_start(v,fmt);
   stb_vsnprintf(buffer,1024,fmt,v);
   va_end(v);
   return stb_p_strdup(buffer);
}

#ifdef _WIN32

#ifndef _WINDOWS_
STB_EXTERN __declspec(dllimport) int __stdcall WriteConsoleA(void *, const void *, unsigned int, unsigned int *, void *);
STB_EXTERN __declspec(dllimport) void * __stdcall GetStdHandle(unsigned int);
STB_EXTERN __declspec(dllimport) int __stdcall SetConsoleTextAttribute(void *, unsigned short);
#endif

static void stb__print_one(void *handle, char *s, ptrdiff_t  len)
{
   if (len)
      if (0==WriteConsoleA(handle, s, (unsigned) len, NULL,NULL))
         // if it fails, maybe redirected, so output normally...
         // but it's supriously reporting failure now on Win7 and later
         {}//fwrite(s, 1, (unsigned) len, stdout);
}

static void stb__print(char *s)
{
   void *handle = GetStdHandle((unsigned int) -11); // STD_OUTPUT_HANDLE
   int pad=0; // number of padding characters to add

   char *t = s;
   while (*s) {
      int lpad;
      while (*s && *s != '{') {
         if (pad) {
            if (*s == '\r' || *s == '\n')
               pad = 0;
            else if (s[0] == ' ' && s[1] == ' ') {
               stb__print_one(handle, t, s-t);
               t = s;
               while (pad) {
                  stb__print_one(handle, t, 1);
                  --pad;
               }
            }
         }
         ++s;
      }
      if (!*s) break;
      stb__print_one(handle, t, s-t);
      if (s[1] == '{') {
         ++s;
         continue;
      }

      if (s[1] == '#') {
         t = s+3;
         if (isxdigit(s[2]))
            if (isdigit(s[2]))
               SetConsoleTextAttribute(handle, s[2] - '0');
            else
               SetConsoleTextAttribute(handle, tolower(s[2]) - 'a' + 10);
         else {
            SetConsoleTextAttribute(handle, 0x0f);
            t=s+2;
         }
      } else if (s[1] == '!') {
         SetConsoleTextAttribute(handle, 0x0c);
         t = s+2;
      } else if (s[1] == '@') {
         SetConsoleTextAttribute(handle, 0x09);
         t = s+2;
      } else if (s[1] == '$') {
         SetConsoleTextAttribute(handle, 0x0a);
         t = s+2;
      } else {
         SetConsoleTextAttribute(handle, 0x08); // 0,7,8,15 => shades of grey
         t = s+1;
      }

      lpad = (int) (t-s);
      s = t;
      while (*s && *s != '}') ++s;
      if (!*s) break;
      stb__print_one(handle, t, s-t);
      if (s[1] == '}') {
         t = s+2;
      } else {
         pad += 1+lpad;
         t = s+1;
      }
      s=t;
      SetConsoleTextAttribute(handle, 0x07);
   }
   stb__print_one(handle, t, s-t);
   SetConsoleTextAttribute(handle, 0x07);
}

void stbprint(const char *fmt, ...)
{
   int res;
   char buffer[1024];
   char *tbuf = buffer;
   va_list v;

   va_start(v,fmt);
   res = stb_vsnprintf(buffer, sizeof(buffer), fmt, v);
   va_end(v);

   if (res < 0) {
      tbuf = (char *) malloc(16384);
      va_start(v,fmt);
      res = stb_vsnprintf(tbuf,16384, fmt, v);
      va_end(v);
      tbuf[16383] = 0;
   }

   stb__print(tbuf);

   if (tbuf != buffer)
      free(tbuf);
}

#else  // _WIN32
void stbprint(const char *fmt, ...)
{
   va_list v;
   va_start(v,fmt);
   vprintf(fmt,v);
   va_end(v);
}
#endif // _WIN32
#endif // STB_DEFINE



//////////////////////////////////////////////////////////////////////////////
//
//                         Windows UTF8 filename handling
//
// Windows stupidly treats 8-bit filenames as some dopey code page,
// rather than utf-8. If we want to use utf8 filenames, we have to
// convert them to WCHAR explicitly and call WCHAR versions of the
// file functions. So, ok, we do.


#ifdef _WIN32
   #define stb__fopen(x,y)    stb_p_wfopen((const wchar_t *)stb__from_utf8(x), (const wchar_t *)stb__from_utf8_alt(y))
   #define stb__windows(x,y)  x
#else
   #define stb__fopen(x,y)    stb_p_fopen(x,y)
   #define stb__windows(x,y)  y
#endif


typedef unsigned short stb__wchar;

STB_EXTERN stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *str, int n);
STB_EXTERN char       * stb_to_utf8  (char *buffer, const stb__wchar *str, int n);

STB_EXTERN stb__wchar *stb__from_utf8(const char *str);
STB_EXTERN stb__wchar *stb__from_utf8_alt(const char *str);
STB_EXTERN char *stb__to_utf8(const stb__wchar *str);


#ifdef STB_DEFINE
stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *ostr, int n)
{
   unsigned char *str = (unsigned char *) ostr;
   stb_uint32 c;
   int i=0;
   --n;
   while (*str) {
      if (i >= n)
         return NULL;
      if (!(*str & 0x80))
         buffer[i++] = *str++;
      else if ((*str & 0xe0) == 0xc0) {
         if (*str < 0xc2) return NULL;
         c = (*str++ & 0x1f) << 6;
         if ((*str & 0xc0) != 0x80) return NULL;
         buffer[i++] = c + (*str++ & 0x3f);
      } else if ((*str & 0xf0) == 0xe0) {
         if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
         if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
         c = (*str++ & 0x0f) << 12;
         if ((*str & 0xc0) != 0x80) return NULL;
         c += (*str++ & 0x3f) << 6;
         if ((*str & 0xc0) != 0x80) return NULL;
         buffer[i++] = c + (*str++ & 0x3f);
      } else if ((*str & 0xf8) == 0xf0) {
         if (*str > 0xf4) return NULL;
         if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
         if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
         c = (*str++ & 0x07) << 18;
         if ((*str & 0xc0) != 0x80) return NULL;
         c += (*str++ & 0x3f) << 12;
         if ((*str & 0xc0) != 0x80) return NULL;
         c += (*str++ & 0x3f) << 6;
         if ((*str & 0xc0) != 0x80) return NULL;
         c += (*str++ & 0x3f);
         // utf-8 encodings of values used in surrogate pairs are invalid
         if ((c & 0xFFFFF800) == 0xD800) return NULL;
         if (c >= 0x10000) {
            c -= 0x10000;
            if (i + 2 > n) return NULL;
            buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
            buffer[i++] = 0xDC00 | (0x3ff & (c      ));
         }
      } else
         return NULL;
   }
   buffer[i] = 0;
   return buffer;
}

char * stb_to_utf8(char *buffer, const stb__wchar *str, int n)
{
   int i=0;
   --n;
   while (*str) {
      if (*str < 0x80) {
         if (i+1 > n) return NULL;
         buffer[i++] = (char) *str++;
      } else if (*str < 0x800) {
         if (i+2 > n) return NULL;
         buffer[i++] = 0xc0 + (*str >> 6);
         buffer[i++] = 0x80 + (*str & 0x3f);
         str += 1;
      } else if (*str >= 0xd800 && *str < 0xdc00) {
         stb_uint32 c;
         if (i+4 > n) return NULL;
         c = ((str[0] - 0xd800) << 10) + ((str[1]) - 0xdc00) + 0x10000;
         buffer[i++] = 0xf0 + (c >> 18);
         buffer[i++] = 0x80 + ((c >> 12) & 0x3f);
         buffer[i++] = 0x80 + ((c >>  6) & 0x3f);
         buffer[i++] = 0x80 + ((c      ) & 0x3f);
         str += 2;
      } else if (*str >= 0xdc00 && *str < 0xe000) {
         return NULL;
      } else {
         if (i+3 > n) return NULL;
         buffer[i++] = 0xe0 + (*str >> 12);
         buffer[i++] = 0x80 + ((*str >> 6) & 0x3f);
         buffer[i++] = 0x80 + ((*str     ) & 0x3f);
         str += 1;
      }
   }
   buffer[i] = 0;
   return buffer;
}

stb__wchar *stb__from_utf8(const char *str)
{
   static stb__wchar buffer[4096];
   return stb_from_utf8(buffer, str, 4096);
}

stb__wchar *stb__from_utf8_alt(const char *str)
{
   static stb__wchar buffer[4096];
   return stb_from_utf8(buffer, str, 4096);
}

char *stb__to_utf8(const stb__wchar *str)
{
   static char buffer[4096];
   return stb_to_utf8(buffer, str, 4096);
}

#endif

//////////////////////////////////////////////////////////////////////////////
//
//                         Miscellany
//

STB_EXTERN void stb_fatal(const char *fmt, ...);
STB_EXTERN void stb_(char *fmt, ...);
STB_EXTERN void stb_append_to_file(char *file, char *fmt, ...);
STB_EXTERN void stb_log(int active);
STB_EXTERN void stb_log_fileline(int active);
STB_EXTERN void stb_log_name(char *filename);

STB_EXTERN void stb_swap(void *p, void *q, size_t sz);
STB_EXTERN void *stb_copy(void *p, size_t sz);
STB_EXTERN void stb_pointer_array_free(void *p, int len);
STB_EXTERN void **stb_array_block_alloc(int count, int blocksize);

#define stb_arrcount(x)   (sizeof(x)/sizeof((x)[0]))


STB_EXTERN int  stb__record_fileline(const char *f, int n);

#ifdef STB_DEFINE

static char *stb__file;
static int   stb__line;

int  stb__record_fileline(const char *f, int n)
{
   stb__file = (char*) f;
   stb__line = n;
   return 0;
}

void stb_fatal(const char *s, ...)
{
   va_list a;
   if (stb__file)
      fprintf(stderr, "[%s:%d] ", stb__file, stb__line);
   va_start(a,s);
   fputs("Fatal error: ", stderr);
   vfprintf(stderr, s, a);
   va_end(a);
   fputs("\n", stderr);
   #ifdef STB_DEBUG
   #ifdef _MSC_VER
   #ifndef STB_PTR64
   __asm int 3;   // trap to debugger!
   #else
   __debugbreak();
   #endif
   #else
   __builtin_trap();
   #endif
   #endif
   exit(1);
}

static int stb__log_active=1, stb__log_fileline=1;

void stb_log(int active)
{
   stb__log_active = active;
}

void stb_log_fileline(int active)
{
   stb__log_fileline = active;
}

#ifdef STB_NO_STB_STRINGS
const char *stb__log_filename = "temp.log";
#else
const char *stb__log_filename = "stb.log";
#endif

void stb_log_name(char *s)
{
   stb__log_filename = s;
}

void stb_(char *s, ...)
{
   if (stb__log_active) {
      FILE *f = stb_p_fopen(stb__log_filename, "a");
      if (f) {
         va_list a;
         if (stb__log_fileline && stb__file)
            fprintf(f, "[%s:%4d] ", stb__file, stb__line);
         va_start(a,s);
         vfprintf(f, s, a);
         va_end(a);
         fputs("\n", f);
         fclose(f);
      }
   }
}

void stb_append_to_file(char *filename, char *s, ...)
{
   FILE *f = stb_p_fopen(filename, "a");
   if (f) {
      va_list a;
      va_start(a,s);
      vfprintf(f, s, a);
      va_end(a);
      fputs("\n", f);
      fclose(f);
   }
}


typedef struct { char d[4]; } stb__4;
typedef struct { char d[8]; } stb__8;

// optimize the small cases, though you shouldn't be calling this for those!
void stb_swap(void *p, void *q, size_t sz)
{
   char buffer[256];
   if (p == q) return;
   if (sz == 4) {
      stb__4 temp    = * ( stb__4 *) p;
      * (stb__4 *) p = * ( stb__4 *) q;
      * (stb__4 *) q = temp;
      return;
   } else if (sz == 8) {
      stb__8 temp    = * ( stb__8 *) p;
      * (stb__8 *) p = * ( stb__8 *) q;
      * (stb__8 *) q = temp;
      return;
   }

   while (sz > sizeof(buffer)) {
      stb_swap(p, q, sizeof(buffer));
      p = (char *) p + sizeof(buffer);
      q = (char *) q + sizeof(buffer);
      sz -= sizeof(buffer);
   }

   memcpy(buffer, p     , sz);
   memcpy(p     , q     , sz);
   memcpy(q     , buffer, sz);
}

void *stb_copy(void *p, size_t sz)
{
   void *q = malloc(sz);
   memcpy(q, p, sz);
   return q;
}

void stb_pointer_array_free(void *q, int len)
{
   void **p = (void **) q;
   int i;
   for (i=0; i < len; ++i)
      free(p[i]);
}

void **stb_array_block_alloc(int count, int blocksize)
{
   int i;
   char *p = (char *) malloc(sizeof(void *) * count + count * blocksize);
   void **q;
   if (p == NULL) return NULL;
   q = (void **) p;
   p += sizeof(void *) * count;
   for (i=0; i < count; ++i)
      q[i] = p + i * blocksize;
   return q;
}
#endif

#ifdef STB_DEBUG
   // tricky hack to allow recording FILE,LINE even in varargs functions
   #define STB__RECORD_FILE(x)  (stb__record_fileline(__FILE__, __LINE__),(x))
   #define stb_log              STB__RECORD_FILE(stb_log)
   #define stb_                 STB__RECORD_FILE(stb_)
   #ifndef STB_FATAL_CLEAN
   #define stb_fatal            STB__RECORD_FILE(stb_fatal)
   #endif
   #define STB__DEBUG(x)        x
#else
   #define STB__DEBUG(x)
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                         stb_temp
//

#define stb_temp(block, sz)     stb__temp(block, sizeof(block), (sz))

STB_EXTERN void * stb__temp(void *b, int b_sz, int want_sz);
STB_EXTERN void   stb_tempfree(void *block, void *ptr);

#ifdef STB_DEFINE

void * stb__temp(void *b, int b_sz, int want_sz)
{
   if (b_sz >= want_sz)
      return b;
   else
      return malloc(want_sz);
}

void   stb_tempfree(void *b, void *p)
{
   if (p != b)
      free(p);
}
#endif


//////////////////////////////////////////////////////////////////////////////
//
//                      math/sampling operations
//


#define stb_lerp(t,a,b)               ( (a) + (t) * (float) ((b)-(a)) )
#define stb_unlerp(t,a,b)             ( ((t) - (a)) / (float) ((b) - (a)) )

#define stb_clamp(x,xmin,xmax)  ((x) < (xmin) ? (xmin) : (x) > (xmax) ? (xmax) : (x))

STB_EXTERN void stb_newell_normal(float *normal, int num_vert, float **vert, int normalize);
STB_EXTERN int stb_box_face_vertex_axis_side(int face_number, int vertex_number, int axis);
STB_EXTERN void stb_linear_controller(float *curpos, float target_pos, float acc, float deacc, float dt);

STB_EXTERN int stb_float_eq(float x, float y, float delta, int max_ulps);
STB_EXTERN int stb_is_prime(unsigned int m);
STB_EXTERN unsigned int stb_power_of_two_nearest_prime(int n);

STB_EXTERN float stb_smoothstep(float t);
STB_EXTERN float stb_cubic_bezier_1d(float t, float p0, float p1, float p2, float p3);

STB_EXTERN double stb_linear_remap(double x, double a, double b,
                                             double c, double d);

#ifdef STB_DEFINE
float stb_smoothstep(float t)
{
   return (3 - 2*t)*(t*t);
}

float stb_cubic_bezier_1d(float t, float p0, float p1, float p2, float p3)
{
   float it = 1-t;
   return it*it*it*p0 + 3*it*it*t*p1 + 3*it*t*t*p2 + t*t*t*p3;
}

void stb_newell_normal(float *normal, int num_vert, float **vert, int normalize)
{
   int i,j;
   float p;
   normal[0] = normal[1] = normal[2] = 0;
   for (i=num_vert-1,j=0; j < num_vert; i=j++) {
      float *u = vert[i];
      float *v = vert[j];
      normal[0] += (u[1] - v[1]) * (u[2] + v[2]);
      normal[1] += (u[2] - v[2]) * (u[0] + v[0]);
      normal[2] += (u[0] - v[0]) * (u[1] + v[1]);
   }
   if (normalize) {
      p = normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2];
      p = (float) (1.0 / sqrt(p));
      normal[0] *= p;
      normal[1] *= p;
      normal[2] *= p;
   }
}

int stb_box_face_vertex_axis_side(int face_number, int vertex_number, int axis)
{
   static int box_vertices[6][4][3] =
   {
      { { 1,1,1 }, { 1,0,1 }, { 1,0,0 }, { 1,1,0 } },
      { { 0,0,0 }, { 0,0,1 }, { 0,1,1 }, { 0,1,0 } },
      { { 0,0,0 }, { 0,1,0 }, { 1,1,0 }, { 1,0,0 } },
      { { 0,0,0 }, { 1,0,0 }, { 1,0,1 }, { 0,0,1 } },
      { { 1,1,1 }, { 0,1,1 }, { 0,0,1 }, { 1,0,1 } },
      { { 1,1,1 }, { 1,1,0 }, { 0,1,0 }, { 0,1,1 } },
   };
   assert(face_number >= 0 && face_number < 6);
   assert(vertex_number >= 0 && vertex_number < 4);
   assert(axis >= 0 && axis < 3);
   return box_vertices[face_number][vertex_number][axis];
}

void stb_linear_controller(float *curpos, float target_pos, float acc, float deacc, float dt)
{
   float sign = 1, p, cp = *curpos;
   if (cp == target_pos) return;
   if (target_pos < cp) {
      target_pos = -target_pos;
      cp = -cp;
      sign = -1;
   }
   // first decelerate
   if (cp < 0) {
      p = cp + deacc * dt;
      if (p > 0) {
         p = 0;
         dt = dt - cp / deacc;
         if (dt < 0) dt = 0;
      } else {
         dt = 0;
      }
      cp = p;
   }
   // now accelerate
   p = cp + acc*dt;
   if (p > target_pos) p = target_pos;
   *curpos = p * sign;
   // @TODO: testing
}

float stb_quadratic_controller(float target_pos, float curpos, float maxvel, float maxacc, float dt, float *curvel)
{
   return 0; // @TODO
}

int stb_float_eq(float x, float y, float delta, int max_ulps)
{
   if (fabs(x-y) <= delta) return 1;
   if (abs(*(int *)&x - *(int *)&y) <= max_ulps) return 1;
   return 0;
}

int stb_is_prime(unsigned int m)
{
   unsigned int i,j;
   if (m < 2) return 0;
   if (m == 2) return 1;
   if (!(m & 1)) return 0;
   if (m % 3 == 0) return (m == 3);
   for (i=5; (j=i*i), j <= m && j > i; i += 6) {
      if (m %   i   == 0) return 0;
      if (m % (i+2) == 0) return 0;
   }
   return 1;
}

unsigned int stb_power_of_two_nearest_prime(int n)
{
   static signed char tab[32] = { 0,0,0,0,1,0,-1,0,1,-1,-1,3,-1,0,-1,2,1,
                                   0,2,0,-1,-4,-1,5,-1,18,-2,15,2,-1,2,0 };
   if (!tab[0]) {
      int i;
      for (i=0; i < 32; ++i)
         tab[i] = (1 << i) + 2*tab[i] - 1;
      tab[1] = 2;
      tab[0] = 1;
   }
   if (n >= 32) return 0xfffffffb;
   return tab[n];
}

double stb_linear_remap(double x, double x_min, double x_max,
                                  double out_min, double out_max)
{
   return stb_lerp(stb_unlerp(x,x_min,x_max),out_min,out_max);
}
#endif

// create a macro so it's faster, but you can get at the function pointer
#define stb_linear_remap(t,a,b,c,d)   stb_lerp(stb_unlerp(t,a,b),c,d)


//////////////////////////////////////////////////////////////////////////////
//
//                         bit operations
//

#define stb_big32(c)    (((c)[0]<<24) + (c)[1]*65536 + (c)[2]*256 + (c)[3])
#define stb_little32(c) (((c)[3]<<24) + (c)[2]*65536 + (c)[1]*256 + (c)[0])
#define stb_big16(c)    ((c)[0]*256 + (c)[1])
#define stb_little16(c) ((c)[1]*256 + (c)[0])

STB_EXTERN          int stb_bitcount(unsigned int a);
STB_EXTERN unsigned int stb_bitreverse8(unsigned char n);
STB_EXTERN unsigned int stb_bitreverse(unsigned int n);

STB_EXTERN          int stb_is_pow2(size_t);
STB_EXTERN          int stb_log2_ceil(size_t);
STB_EXTERN          int stb_log2_floor(size_t);

STB_EXTERN          int stb_lowbit8(unsigned int n);
STB_EXTERN          int stb_highbit8(unsigned int n);

#ifdef STB_DEFINE
int stb_bitcount(unsigned int a)
{
   a = (a & 0x55555555) + ((a >>  1) & 0x55555555); // max 2
   a = (a & 0x33333333) + ((a >>  2) & 0x33333333); // max 4
   a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
   a = (a + (a >> 8)); // max 16 per 8 bits
   a = (a + (a >> 16)); // max 32 per 8 bits
   return a & 0xff;
}

unsigned int stb_bitreverse8(unsigned char n)
{
   n = ((n & 0xAA) >> 1) + ((n & 0x55) << 1);
   n = ((n & 0xCC) >> 2) + ((n & 0x33) << 2);
   return (unsigned char) ((n >> 4) + (n << 4));
}

unsigned int stb_bitreverse(unsigned int n)
{
  n = ((n & 0xAAAAAAAA) >>  1) | ((n & 0x55555555) << 1);
  n = ((n & 0xCCCCCCCC) >>  2) | ((n & 0x33333333) << 2);
  n = ((n & 0xF0F0F0F0) >>  4) | ((n & 0x0F0F0F0F) << 4);
  n = ((n & 0xFF00FF00) >>  8) | ((n & 0x00FF00FF) << 8);
  return (n >> 16) | (n << 16);
}

int stb_is_pow2(size_t n)
{
   return (n & (n-1)) == 0;
}

// tricky use of 4-bit table to identify 5 bit positions (note the '-1')
// 3-bit table would require another tree level; 5-bit table wouldn't save one
#if defined(_WIN32) && !defined(__MINGW32__)
#pragma warning(push)
#pragma warning(disable: 4035)  // disable warning about no return value
int stb_log2_floor(size_t n)
{
   #if _MSC_VER > 1700
   unsigned long i;
   #ifdef STB_PTR64
   _BitScanReverse64(&i, n);
   #else
   _BitScanReverse(&i, n);
   #endif
   return i != 0 ? i : -1;
   #else
   __asm {
      bsr eax,n
      jnz done
      mov eax,-1
   }
   done:;
   #endif
}
#pragma warning(pop)
#else
int stb_log2_floor(size_t n)
{
   static signed char log2_4[16] = { -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3 };

#ifdef STB_PTR64
   if (n >= ((size_t) 1u << 32))
        return stb_log2_floor(n >> 32);
#endif

   // 2 compares if n < 16, 3 compares otherwise
   if (n < (1U << 14))
        if (n < (1U <<  4))        return     0 + log2_4[n      ];
        else if (n < (1U <<  9))      return  5 + log2_4[n >>  5];
             else                     return 10 + log2_4[n >> 10];
   else if (n < (1U << 24))
             if (n < (1U << 19))      return 15 + log2_4[n >> 15];
             else                     return 20 + log2_4[n >> 20];
        else if (n < (1U << 29))      return 25 + log2_4[n >> 25];
             else                     return 30 + log2_4[n >> 30];
}
#endif

// define ceil from floor
int stb_log2_ceil(size_t n)
{
   if (stb_is_pow2(n))  return     stb_log2_floor(n);
   else                 return 1 + stb_log2_floor(n);
}

int stb_highbit8(unsigned int n)
{
   return stb_log2_ceil(n&255);
}

int stb_lowbit8(unsigned int n)
{
   static signed char lowbit4[16] = { -1,0,1,0, 2,0,1,0, 3,0,1,0, 2,0,1,0 };
   int k = lowbit4[n & 15];
   if (k >= 0) return k;
   k = lowbit4[(n >> 4) & 15];
   if (k >= 0) return k+4;
   return k;
}
#endif



//////////////////////////////////////////////////////////////////////////////
//
//                            qsort Compare Routines
//

#ifdef _WIN32
   #define stb_stricmp(a,b) stb_p_stricmp(a,b)
   #define stb_strnicmp(a,b,n) stb_p_strnicmp(a,b,n)
#else
   #define stb_stricmp(a,b) strcasecmp(a,b)
   #define stb_strnicmp(a,b,n) strncasecmp(a,b,n)
#endif


STB_EXTERN int (*stb_intcmp(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_intcmprev(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_qsort_strcmp(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_qsort_stricmp(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_floatcmp(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_doublecmp(int offset))(const void *a, const void *b);
STB_EXTERN int (*stb_charcmp(int offset))(const void *a, const void *b);

#ifdef STB_DEFINE
static int stb__intcmpoffset, stb__ucharcmpoffset, stb__strcmpoffset;
static int stb__floatcmpoffset, stb__doublecmpoffset;
static int stb__memcmpoffset, stb__memcmpsize;

int stb__intcmp(const void *a, const void *b)
{
   const int p = *(const int *) ((const char *) a + stb__intcmpoffset);
   const int q = *(const int *) ((const char *) b + stb__intcmpoffset);
   return p < q ? -1 : p > q;
}

int stb__intcmprev(const void *a, const void *b)
{
   const int p = *(const int *) ((const char *) a + stb__intcmpoffset);
   const int q = *(const int *) ((const char *) b + stb__intcmpoffset);
   return q < p ? -1 : q > p;
}

int stb__ucharcmp(const void *a, const void *b)
{
   const int p = *(const unsigned char *) ((const char *) a + stb__ucharcmpoffset);
   const int q = *(const unsigned char *) ((const char *) b + stb__ucharcmpoffset);
   return p < q ? -1 : p > q;
}

int stb__floatcmp(const void *a, const void *b)
{
   const float p = *(const float *) ((const char *) a + stb__floatcmpoffset);
   const float q = *(const float *) ((const char *) b + stb__floatcmpoffset);
   return p < q ? -1 : p > q;
}

int stb__doublecmp(const void *a, const void *b)
{
   const double p = *(const double *) ((const char *) a + stb__doublecmpoffset);
   const double q = *(const double *) ((const char *) b + stb__doublecmpoffset);
   return p < q ? -1 : p > q;
}

int stb__qsort_strcmp(const void *a, const void *b)
{
   const char *p = *(const char **) ((const char *) a + stb__strcmpoffset);
   const char *q = *(const char **) ((const char *) b + stb__strcmpoffset);
   return strcmp(p,q);
}

int stb__qsort_stricmp(const void *a, const void *b)
{
   const char *p = *(const char **) ((const char *) a + stb__strcmpoffset);
   const char *q = *(const char **) ((const char *) b + stb__strcmpoffset);
   return stb_stricmp(p,q);
}

int stb__memcmp(const void *a, const void *b)
{
   return memcmp((char *) a + stb__memcmpoffset, (char *) b + stb__memcmpoffset, stb__memcmpsize);
}

int (*stb_intcmp(int offset))(const void *, const void *)
{
   stb__intcmpoffset = offset;
   return &stb__intcmp;
}

int (*stb_intcmprev(int offset))(const void *, const void *)
{
   stb__intcmpoffset = offset;
   return &stb__intcmprev;
}

int (*stb_ucharcmp(int offset))(const void *, const void *)
{
   stb__ucharcmpoffset = offset;
   return &stb__ucharcmp;
}

int (*stb_qsort_strcmp(int offset))(const void *, const void *)
{
   stb__strcmpoffset = offset;
   return &stb__qsort_strcmp;
}

int (*stb_qsort_stricmp(int offset))(const void *, const void *)
{
   stb__strcmpoffset = offset;
   return &stb__qsort_stricmp;
}

int (*stb_floatcmp(int offset))(const void *, const void *)
{
   stb__floatcmpoffset = offset;
   return &stb__floatcmp;
}

int (*stb_doublecmp(int offset))(const void *, const void *)
{
   stb__doublecmpoffset = offset;
   return &stb__doublecmp;
}

int (*stb_memcmp(int offset, int size))(const void *, const void *)
{
   stb__memcmpoffset = offset;
   stb__memcmpsize = size;
   return &stb__memcmp;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                           Binary Search Toolkit
//

typedef struct
{
   int minval, maxval, guess;
   int mode, step;
} stb_search;

STB_EXTERN int stb_search_binary(stb_search *s, int minv, int maxv, int find_smallest);
STB_EXTERN int stb_search_open(stb_search *s, int minv, int find_smallest);
STB_EXTERN int stb_probe(stb_search *s, int compare, int *result); // return 0 when done

#ifdef STB_DEFINE
enum
{
   STB_probe_binary_smallest,
   STB_probe_binary_largest,
   STB_probe_open_smallest,
   STB_probe_open_largest,
};

static int stb_probe_guess(stb_search *s, int *result)
{
   switch(s->mode) {
      case STB_probe_binary_largest:
         if (s->minval == s->maxval) {
            *result = s->minval;
            return 0;
         }
         assert(s->minval < s->maxval);
         // if a < b, then a < p <= b
         s->guess = s->minval + (((unsigned) s->maxval - s->minval + 1) >> 1);
         break;

      case STB_probe_binary_smallest:
         if (s->minval == s->maxval) {
            *result = s->minval;
            return 0;
         }
         assert(s->minval < s->maxval);
         // if a < b, then a <= p < b
         s->guess = s->minval + (((unsigned) s->maxval - s->minval) >> 1);
         break;
      case STB_probe_open_smallest:
      case STB_probe_open_largest:
         s->guess = s->maxval;  // guess the current maxval
         break;
   }
   *result = s->guess;
   return 1;
}

int stb_probe(stb_search *s, int compare, int *result)
{
   switch(s->mode) {
      case STB_probe_open_smallest:
      case STB_probe_open_largest: {
         if (compare <= 0) {
            // then it lies within minval & maxval
            if (s->mode == STB_probe_open_smallest)
               s->mode = STB_probe_binary_smallest;
            else
               s->mode = STB_probe_binary_largest;
         } else {
            // otherwise, we need to probe larger
            s->minval  = s->maxval + 1;
            s->maxval  = s->minval + s->step;
            s->step   += s->step;
         }
         break;
      }
      case STB_probe_binary_smallest: {
         // if compare < 0, then s->minval <= a <  p
         // if compare = 0, then s->minval <= a <= p
         // if compare > 0, then         p <  a <= s->maxval
         if (compare <= 0)
            s->maxval = s->guess;
         else
            s->minval = s->guess+1;
         break;
      }
      case STB_probe_binary_largest: {
         // if compare < 0, then s->minval <= a < p
         // if compare = 0, then         p <= a <= s->maxval
         // if compare > 0, then         p <  a <= s->maxval
         if (compare < 0)
            s->maxval = s->guess-1;
         else
            s->minval = s->guess;
         break;
      }
   }
   return stb_probe_guess(s, result);
}

int stb_search_binary(stb_search *s, int minv, int maxv, int find_smallest)
{
   int r;
   if (maxv < minv) return minv-1;
   s->minval = minv;
   s->maxval = maxv;
   s->mode = find_smallest ? STB_probe_binary_smallest : STB_probe_binary_largest;
   stb_probe_guess(s, &r);
   return r;
}

int stb_search_open(stb_search *s, int minv, int find_smallest)
{
   int r;
   s->step   = 4;
   s->minval = minv;
   s->maxval = minv+s->step;
   s->mode = find_smallest ? STB_probe_open_smallest : STB_probe_open_largest;
   stb_probe_guess(s, &r);
   return r;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                           String Processing
//

#define stb_prefixi(s,t)  (0==stb_strnicmp((s),(t),strlen(t)))

enum stb_splitpath_flag
{
   STB_PATH = 1,
   STB_FILE = 2,
   STB_EXT  = 4,
   STB_PATH_FILE = STB_PATH + STB_FILE,
   STB_FILE_EXT  = STB_FILE + STB_EXT,
   STB_EXT_NO_PERIOD = 8,
};

STB_EXTERN char * stb_skipwhite(char *s);
STB_EXTERN char * stb_trimwhite(char *s);
STB_EXTERN char * stb_skipnewline(char *s);
STB_EXTERN char * stb_strncpy(char *s, char *t, int n);
STB_EXTERN char * stb_substr(char *t, int n);
STB_EXTERN char * stb_duplower(char *s);
STB_EXTERN void   stb_tolower (char *s);
STB_EXTERN char * stb_strchr2 (char *s, char p1, char p2);
STB_EXTERN char * stb_strrchr2(char *s, char p1, char p2);
STB_EXTERN char * stb_strtok(char *output, char *src, char *delimit);
STB_EXTERN char * stb_strtok_keep(char *output, char *src, char *delimit);
STB_EXTERN char * stb_strtok_invert(char *output, char *src, char *allowed);
STB_EXTERN char * stb_dupreplace(char *s, char *find, char *replace);
STB_EXTERN void   stb_replaceinplace(char *s, char *find, char *replace);
STB_EXTERN char * stb_splitpath(char *output, char *src, int flag);
STB_EXTERN char * stb_splitpathdup(char *src, int flag);
STB_EXTERN char * stb_replacedir(char *output, char *src, char *dir);
STB_EXTERN char * stb_replaceext(char *output, char *src, char *ext);
STB_EXTERN void   stb_fixpath(char *path);
STB_EXTERN char * stb_shorten_path_readable(char *path, int max_len);
STB_EXTERN int    stb_suffix (char *s, char *t);
STB_EXTERN int    stb_suffixi(char *s, char *t);
STB_EXTERN int    stb_prefix (char *s, char *t);
STB_EXTERN char * stb_strichr(char *s, char t);
STB_EXTERN char * stb_stristr(char *s, char *t);
STB_EXTERN int    stb_prefix_count(char *s, char *t);
STB_EXTERN const char * stb_plural(int n);  // "s" or ""
STB_EXTERN size_t stb_strscpy(char *d, const char *s, size_t n);

STB_EXTERN char **stb_tokens(char *src, char *delimit, int *count);
STB_EXTERN char **stb_tokens_nested(char *src, char *delimit, int *count, char *nest_in, char *nest_out);
STB_EXTERN char **stb_tokens_nested_empty(char *src, char *delimit, int *count, char *nest_in, char *nest_out);
STB_EXTERN char **stb_tokens_allowempty(char *src, char *delimit, int *count);
STB_EXTERN char **stb_tokens_stripwhite(char *src, char *delimit, int *count);
STB_EXTERN char **stb_tokens_withdelim(char *src, char *delimit, int *count);
STB_EXTERN char **stb_tokens_quoted(char *src, char *delimit, int *count);
// with 'quoted', allow delimiters to appear inside quotation marks, and don't
// strip whitespace inside them (and we delete the quotation marks unless they
// appear back to back, in which case they're considered escaped)

#ifdef STB_DEFINE

size_t stb_strscpy(char *d, const char *s, size_t n)
{
   size_t len = strlen(s);
   if (len >= n) {
      if (n) d[0] = 0;
      return 0;
   }
   stb_p_strcpy_s(d,n,s);
   return len;
}

const char *stb_plural(int n)
{
   return n == 1 ? "" : "s";
}

int stb_prefix(char *s, char *t)
{
   while (*t)
      if (*s++ != *t++)
         return STB_FALSE;
   return STB_TRUE;
}

int stb_prefix_count(char *s, char *t)
{
   int c=0;
   while (*t) {
      if (*s++ != *t++)
         break;
      ++c;
   }
   return c;
}

int stb_suffix(char *s, char *t)
{
   size_t n = strlen(s);
   size_t m = strlen(t);
   if (m <= n)
      return 0 == strcmp(s+n-m, t);
   else
      return 0;
}

int stb_suffixi(char *s, char *t)
{
   size_t n = strlen(s);
   size_t m = strlen(t);
   if (m <= n)
      return 0 == stb_stricmp(s+n-m, t);
   else
      return 0;
}

// originally I was using this table so that I could create known sentinel
// values--e.g. change whitetable[0] to be true if I was scanning for whitespace,
// and false if I was scanning for nonwhite. I don't appear to be using that
// functionality anymore (I do for tokentable, though), so just replace it
// with isspace()
char *stb_skipwhite(char *s)
{
   while (isspace((unsigned char) *s)) ++s;
   return s;
}

char *stb_skipnewline(char *s)
{
   if (s[0] == '\r' || s[0] == '\n') {
      if (s[0]+s[1] == '\r' + '\n') ++s;
      ++s;
   }
   return s;
}

char *stb_trimwhite(char *s)
{
   int i,n;
   s = stb_skipwhite(s);
   n = (int) strlen(s);
   for (i=n-1; i >= 0; --i)
      if (!isspace(s[i]))
         break;
   s[i+1] = 0;
   return s;
}

char *stb_strncpy(char *s, char *t, int n)
{
   stb_p_strncpy_s(s,n+1,t,n);
   s[n] = 0;
   return s;
}

char *stb_substr(char *t, int n)
{
   char *a;
   int z = (int) strlen(t);
   if (z < n) n = z;
   a = (char *) malloc(n+1);
   stb_p_strncpy_s(a,n+1,t,n);
   a[n] = 0;
   return a;
}

char *stb_duplower(char *s)
{
   char *p = stb_p_strdup(s), *q = p;
   while (*q) {
      *q = tolower(*q);
      ++q;
   }
   return p;
}

void stb_tolower(char *s)
{
   while (*s) {
      *s = tolower(*s);
      ++s;
   }
}

char *stb_strchr2(char *s, char x, char y)
{
   for(; *s; ++s)
      if (*s == x || *s == y)
         return s;
   return NULL;
}

char *stb_strrchr2(char *s, char x, char y)
{
   char *r = NULL;
   for(; *s; ++s)
      if (*s == x || *s == y)
         r = s;
   return r;
}

char *stb_strichr(char *s, char t)
{
   if (tolower(t) == toupper(t))
      return strchr(s,t);
   return stb_strchr2(s, (char) tolower(t), (char) toupper(t));
}

char *stb_stristr(char *s, char *t)
{
   size_t n = strlen(t);
   char *z;
   if (n==0) return s;
   while ((z = stb_strichr(s, *t)) != NULL) {
      if (0==stb_strnicmp(z, t, n))
         return z;
      s = z+1;
   }
   return NULL;
}

static char *stb_strtok_raw(char *output, char *src, char *delimit, int keep, int invert)
{
   if (invert) {
      while (*src && strchr(delimit, *src) != NULL) {
         *output++ = *src++;
      }
   } else {
      while (*src && strchr(delimit, *src) == NULL) {
         *output++ = *src++;
      }
   }
   *output = 0;
   if (keep)
      return src;
   else
      return *src ? src+1 : src;
}

char *stb_strtok(char *output, char *src, char *delimit)
{
   return stb_strtok_raw(output, src, delimit, 0, 0);
}

char *stb_strtok_keep(char *output, char *src, char *delimit)
{
   return stb_strtok_raw(output, src, delimit, 1, 0);
}

char *stb_strtok_invert(char *output, char *src, char *delimit)
{
   return stb_strtok_raw(output, src, delimit, 1,1);
}

static char **stb_tokens_raw(char *src_, char *delimit, int *count,
                             int stripwhite, int allow_empty, char *start, char *end)
{
   int nested = 0;
   unsigned char *src = (unsigned char *) src_;
   static char stb_tokentable[256]; // rely on static initializion to 0
   static char stable[256],etable[256];
   char *out;
   char **result;
   int num=0;
   unsigned char *s;

   s = (unsigned char *) delimit; while (*s) stb_tokentable[*s++] = 1;
   if (start) {
      s = (unsigned char *) start;         while (*s) stable[*s++] = 1;
      s = (unsigned char *) end;   if (s)  while (*s) stable[*s++] = 1;
      s = (unsigned char *) end;   if (s)  while (*s) etable[*s++] = 1;
   }
   stable[0] = 1;

   // two passes through: the first time, counting how many
   s = (unsigned char *) src;
   while (*s) {
      // state: just found delimiter
      // skip further delimiters
      if (!allow_empty) {
         stb_tokentable[0] = 0;
         while (stb_tokentable[*s])
            ++s;
         if (!*s) break;
      }
      ++num;
      // skip further non-delimiters
      stb_tokentable[0] = 1;
      if (stripwhite == 2) { // quoted strings
         while (!stb_tokentable[*s]) {
            if (*s != '"')
               ++s;
            else {
               ++s;
               if (*s == '"')
                  ++s;   // "" -> ", not start a string
               else {
                  // begin a string
                  while (*s) {
                     if (s[0] == '"') {
                        if (s[1] == '"') s += 2; // "" -> "
                        else { ++s; break; } // terminating "
                     } else
                        ++s;
                  }
               }
            }
         }
      } else
         while (nested || !stb_tokentable[*s]) {
            if (stable[*s]) {
               if (!*s) break;
               if (end ? etable[*s] : nested)
                  --nested;
               else
                  ++nested;
            }
            ++s;
         }
      if (allow_empty) {
         if (*s) ++s;
      }
   }
   // now num has the actual count... malloc our output structure
   // need space for all the strings: strings won't be any longer than
   // original input, since for every '\0' there's at least one delimiter
   result = (char **) malloc(sizeof(*result) * (num+1) + (s-src+1));
   if (result == NULL) return result;
   out = (char *) (result + (num+1));
   // second pass: copy out the data
   s = (unsigned char *) src;
   num = 0;
   nested = 0;
   while (*s) {
      char *last_nonwhite;
      // state: just found delimiter
      // skip further delimiters
      if (!allow_empty) {
         stb_tokentable[0] = 0;
         if (stripwhite)
            while (stb_tokentable[*s] || isspace(*s))
               ++s;
         else
            while (stb_tokentable[*s])
               ++s;
      } else if (stripwhite) {
         while (isspace(*s)) ++s;
      }
      if (!*s) break;
      // we're past any leading delimiters and whitespace
      result[num] = out;
      ++num;
      // copy non-delimiters
      stb_tokentable[0] = 1;
      last_nonwhite = out-1;
      if (stripwhite == 2) {
         while (!stb_tokentable[*s]) {
            if (*s != '"') {
               if (!isspace(*s)) last_nonwhite = out;
               *out++ = *s++;
            } else {
               ++s;
               if (*s == '"') {
                  if (!isspace(*s)) last_nonwhite = out;
                  *out++ = *s++; // "" -> ", not start string
               } else {
                  // begin a quoted string
                  while (*s) {
                     if (s[0] == '"') {
                        if (s[1] == '"') { *out++ = *s; s += 2; }
                        else { ++s; break; } // terminating "
                     } else
                        *out++ = *s++;
                  }
                  last_nonwhite = out-1; // all in quotes counts as non-white
               }
            }
         }
      } else {
         while (nested || !stb_tokentable[*s]) {
            if (!isspace(*s)) last_nonwhite = out;
            if (stable[*s]) {
               if (!*s) break;
               if (end ? etable[*s] : nested)
                  --nested;
               else
                  ++nested;
            }
            *out++ = *s++;
         }
      }

      if (stripwhite) // rewind to last non-whitespace char
         out = last_nonwhite+1;
      *out++ = '\0';

      if (*s) ++s; // skip delimiter
   }
   s = (unsigned char *) delimit; while (*s) stb_tokentable[*s++] = 0;
   if (start) {
      s = (unsigned char *) start;         while (*s) stable[*s++] = 1;
      s = (unsigned char *) end;   if (s)  while (*s) stable[*s++] = 1;
      s = (unsigned char *) end;   if (s)  while (*s) etable[*s++] = 1;
   }
   if (count != NULL) *count = num;
   result[num] = 0;
   return result;
}

char **stb_tokens(char *src, char *delimit, int *count)
{
   return stb_tokens_raw(src,delimit,count,0,0,0,0);
}

char **stb_tokens_nested(char *src, char *delimit, int *count, char *nest_in, char *nest_out)
{
   return stb_tokens_raw(src,delimit,count,0,0,nest_in,nest_out);
}

char **stb_tokens_nested_empty(char *src, char *delimit, int *count, char *nest_in, char *nest_out)
{
   return stb_tokens_raw(src,delimit,count,0,1,nest_in,nest_out);
}

char **stb_tokens_allowempty(char *src, char *delimit, int *count)
{
   return stb_tokens_raw(src,delimit,count,0,1,0,0);
}

char **stb_tokens_stripwhite(char *src, char *delimit, int *count)
{
   return stb_tokens_raw(src,delimit,count,1,1,0,0);
}

char **stb_tokens_quoted(char *src, char *delimit, int *count)
{
   return stb_tokens_raw(src,delimit,count,2,1,0,0);
}

char *stb_dupreplace(char *src, char *find, char *replace)
{
   size_t len_find = strlen(find);
   size_t len_replace = strlen(replace);
   int count = 0;

   char *s,*p,*q;

   s = strstr(src, find);
   if (s == NULL) return stb_p_strdup(src);
   do {
      ++count;
      s = strstr(s + len_find, find);
   } while (s != NULL);

   p = (char *)  malloc(strlen(src) + count * (len_replace - len_find) + 1);
   if (p == NULL) return p;
   q = p;
   s = src;
   for (;;) {
      char *t = strstr(s, find);
      if (t == NULL) {
         stb_p_strcpy_s(q,strlen(src)+count*(len_replace-len_find)+1,s);
         assert(strlen(p) == strlen(src) + count*(len_replace-len_find));
         return p;
      }
      memcpy(q, s, t-s);
      q += t-s;
      memcpy(q, replace, len_replace);
      q += len_replace;
      s = t + len_find;
   }
}

void stb_replaceinplace(char *src, char *find, char *replace)
{
   size_t len_find = strlen(find);
   size_t len_replace = strlen(replace);
   int delta;

   char *s,*p,*q;

   delta = (int) (len_replace - len_find);
   assert(delta <= 0);
   if (delta > 0) return;

   p = strstr(src, find);
   if (p == NULL) return;

   s = q = p;
   while (*s) {
      memcpy(q, replace, len_replace);
      p += len_find;
      q += len_replace;
      s = strstr(p, find);
      if (s == NULL) s = p + strlen(p);
      memmove(q, p, s-p);
      q += s-p;
      p = s;
   }
   *q = 0;
}

void stb_fixpath(char *path)
{
   for(; *path; ++path)
      if (*path == '\\')
         *path = '/';
}

void stb__add_section(char *buffer, char *data, ptrdiff_t curlen, ptrdiff_t newlen)
{
   if (newlen < curlen) {
      ptrdiff_t z1 = newlen >> 1, z2 = newlen-z1;
      memcpy(buffer, data, z1-1);
      buffer[z1-1] = '.';
      buffer[z1-0] = '.';
      memcpy(buffer+z1+1, data+curlen-z2+1, z2-1);
   } else
      memcpy(buffer, data, curlen);
}

char * stb_shorten_path_readable(char *path, int len)
{
   static char buffer[1024];
   ptrdiff_t n = strlen(path),n1,n2,r1,r2;
   char *s;
   if (n <= len) return path;
   if (len > 1024) return path;
   s = stb_strrchr2(path, '/', '\\');
   if (s) {
      n1 = s - path + 1;
      n2 = n - n1;
      ++s;
   } else {
      n1 = 0;
      n2 = n;
      s = path;
   }
   // now we need to reduce r1 and r2 so that they fit in len
   if (n1 < len>>1) {
      r1 = n1;
      r2 = len - r1;
   } else if (n2 < len >> 1) {
      r2 = n2;
      r1 = len - r2;
   } else {
      r1 = n1 * len / n;
      r2 = n2 * len / n;
      if (r1 < len>>2) r1 = len>>2, r2 = len-r1;
      if (r2 < len>>2) r2 = len>>2, r1 = len-r2;
   }
   assert(r1 <= n1 && r2 <= n2);
   if (n1)
      stb__add_section(buffer, path, n1, r1);
   stb__add_section(buffer+r1, s, n2, r2);
   buffer[len] = 0;
   return buffer;
}

static char *stb__splitpath_raw(char *buffer, char *path, int flag)
{
   ptrdiff_t len=0,x,y, n = (int) strlen(path), f1,f2;
   char *s = stb_strrchr2(path, '/', '\\');
   char *t = strrchr(path, '.');
   if (s && t && t < s) t = NULL;

   if (!s) {
      // check for drive
      if (isalpha(path[0]) && path[1] == ':')
         s = &path[1];
   }
   if (s) ++s;

   if (flag == STB_EXT_NO_PERIOD)
      flag |= STB_EXT;

   if (!(flag & (STB_PATH | STB_FILE | STB_EXT))) return NULL;

   f1 = s == NULL ? 0 : s-path; // start of filename
   f2 = t == NULL ? n : t-path; // just past end of filename

   if (flag & STB_PATH) {
      x = 0; if (f1 == 0 && flag == STB_PATH) len=2;
   } else if (flag & STB_FILE) {
      x = f1;
   } else {
      x = f2;
      if (flag & STB_EXT_NO_PERIOD)
         if (path[x] == '.')
            ++x;
   }

   if (flag & STB_EXT)
      y = n;
   else if (flag & STB_FILE)
      y = f2;
   else
      y = f1;

   if (buffer == NULL) {
      buffer = (char *) malloc(y-x + len + 1);
      if (!buffer) return NULL;
   }

   if (len) { stb_p_strcpy_s(buffer, 3, "./"); return buffer; }
   stb_strncpy(buffer, path+(int)x, (int)(y-x));
   return buffer;
}

char *stb_splitpath(char *output, char *src, int flag)
{
   return stb__splitpath_raw(output, src, flag);
}

char *stb_splitpathdup(char *src, int flag)
{
   return stb__splitpath_raw(NULL, src, flag);
}

char *stb_replacedir(char *output, char *src, char *dir)
{
   char buffer[4096];
   stb_splitpath(buffer, src, STB_FILE | STB_EXT);
   if (dir)
      stb_p_sprintf(output stb_p_size(9999), "%s/%s", dir, buffer);
   else
      stb_p_strcpy_s(output, sizeof(buffer),  buffer); // @UNSAFE
   return output;
}

char *stb_replaceext(char *output, char *src, char *ext)
{
   char buffer[4096];
   stb_splitpath(buffer, src, STB_PATH | STB_FILE);
   if (ext)
      stb_p_sprintf(output stb_p_size(9999), "%s.%s", buffer, ext[0] == '.' ? ext+1 : ext);
   else
      stb_p_strcpy_s(output, sizeof(buffer), buffer); // @UNSAFE
   return output;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                   stb_alloc - hierarchical allocator
//
//                                     inspired by http://swapped.cc/halloc
//
//
// When you alloc a given block through stb_alloc, you have these choices:
//
//       1. does it have a parent?
//       2. can it have children?
//       3. can it be freed directly?
//       4. is it transferrable?
//       5. what is its alignment?
//
// Here are interesting combinations of those:
//
//                              children   free    transfer     alignment
//  arena                          Y         Y         N           n/a
//  no-overhead, chunked           N         N         N         normal
//  string pool alloc              N         N         N            1
//  parent-ptr, chunked            Y         N         N         normal
//  low-overhead, unchunked        N         Y         Y         normal
//  general purpose alloc          Y         Y         Y         normal
//
// Unchunked allocations will probably return 16-aligned pointers. If
// we 16-align the results, we have room for 4 pointers. For smaller
// allocations that allow finer alignment, we can reduce the pointers.
//
// The strategy is that given a pointer, assuming it has a header (only
// the no-overhead allocations have no header), we can determine the
// type of the header fields, and the number of them, by stepping backwards
// through memory and looking at the tags in the bottom bits.
//
// Implementation strategy:
//     chunked allocations come from the middle of chunks, and can't
//     be freed. thefore they do not need to be on a sibling chain.
//     they may need child pointers if they have children.
//
// chunked, with-children
//     void *parent;
//
// unchunked, no-children -- reduced storage
//     void *next_sibling;
//     void *prev_sibling_nextp;
//
// unchunked, general
//     void *first_child;
//     void *next_sibling;
//     void *prev_sibling_nextp;
//     void *chunks;
//
// so, if we code each of these fields with different bit patterns
// (actually same one for next/prev/child), then we can identify which
// each one is from the last field.

STB_EXTERN void  stb_free(void *p);
STB_EXTERN void *stb_malloc_global(size_t size);
STB_EXTERN void *stb_malloc(void *context, size_t size);
STB_EXTERN void *stb_malloc_nofree(void *context, size_t size);
STB_EXTERN void *stb_malloc_leaf(void *context, size_t size);
STB_EXTERN void *stb_malloc_raw(void *context, size_t size);
STB_EXTERN void *stb_realloc(void *ptr, size_t newsize);

STB_EXTERN void stb_reassign(void *new_context, void *ptr);
STB_EXTERN void stb_malloc_validate(void *p, void *parent);

extern int stb_alloc_chunk_size ;
extern int stb_alloc_count_free ;
extern int stb_alloc_count_alloc;
extern int stb_alloc_alignment  ;

#ifdef STB_DEFINE

int stb_alloc_chunk_size  = 65536;
int stb_alloc_count_free  = 0;
int stb_alloc_count_alloc = 0;
int stb_alloc_alignment   = -16;

typedef struct stb__chunk
{
   struct stb__chunk *next;
   int                data_left;
   int                alloc;
} stb__chunk;

typedef struct
{
   void *  next;
   void ** prevn;
} stb__nochildren;

typedef struct
{
   void ** prevn;
   void *  child;
   void *  next;
   stb__chunk *chunks;
} stb__alloc;

typedef struct
{
   stb__alloc *parent;
} stb__chunked;

#define STB__PARENT          1
#define STB__CHUNKS          2

typedef enum
{
   STB__nochildren = 0,
   STB__chunked    = STB__PARENT,
   STB__alloc      = STB__CHUNKS,

   STB__chunk_raw  = 4,
} stb__alloc_type;

// these functions set the bottom bits of a pointer efficiently
#define STB__DECODE(x,v)  ((void *) ((char *) (x) - (v)))
#define STB__ENCODE(x,v)  ((void *) ((char *) (x) + (v)))

#define stb__parent(z)       (stb__alloc *) STB__DECODE((z)->parent, STB__PARENT)
#define stb__chunks(z)       (stb__chunk *) STB__DECODE((z)->chunks, STB__CHUNKS)

#define stb__setparent(z,p)  (z)->parent = (stb__alloc *) STB__ENCODE((p), STB__PARENT)
#define stb__setchunks(z,c)  (z)->chunks = (stb__chunk *) STB__ENCODE((c), STB__CHUNKS)

static stb__alloc stb__alloc_global =
{
   NULL,
   NULL,
   NULL,
   (stb__chunk *) STB__ENCODE(NULL, STB__CHUNKS)
};

static stb__alloc_type stb__identify(void *p)
{
   void **q = (void **) p;
   return (stb__alloc_type) ((stb_uinta) q[-1] & 3);
}

static void *** stb__prevn(void *p)
{
   if (stb__identify(p) == STB__alloc) {
      stb__alloc      *s = (stb__alloc *) p - 1;
      return &s->prevn;
   } else {
      stb__nochildren *s = (stb__nochildren *) p - 1;
      return &s->prevn;
   }
}

void stb_free(void *p)
{
   if (p == NULL) return;

   // count frees so that unit tests can see what's happening
   ++stb_alloc_count_free;

   switch(stb__identify(p)) {
      case STB__chunked:
         // freeing a chunked-block with children does nothing;
         // they only get freed when the parent does
         // surely this is wrong, and it should free them immediately?
         // otherwise how are they getting put on the right chain?
         return;
      case STB__nochildren: {
         stb__nochildren *s = (stb__nochildren *) p - 1;
         // unlink from sibling chain
         *(s->prevn) = s->next;
         if (s->next)
            *stb__prevn(s->next) = s->prevn;
         free(s);
         return;
      }
      case STB__alloc: {
         stb__alloc *s = (stb__alloc *) p - 1;
         stb__chunk *c, *n;
         void *q;

         // unlink from sibling chain, if any
         *(s->prevn) = s->next;
         if (s->next)
            *stb__prevn(s->next) = s->prevn;

         // first free chunks
         c = (stb__chunk *) stb__chunks(s);
         while (c != NULL) {
            n = c->next;
            stb_alloc_count_free += c->alloc;
            free(c);
            c = n;
         }

         // validating
         stb__setchunks(s,NULL);
         s->prevn = NULL;
         s->next = NULL;

         // now free children
         while ((q = s->child) != NULL) {
            stb_free(q);
         }

         // now free self
         free(s);
         return;
      }
      default:
         assert(0); /* NOTREACHED */
   }
}

void stb_malloc_validate(void *p, void *parent)
{
   if (p == NULL) return;

   switch(stb__identify(p)) {
      case STB__chunked:
         return;
      case STB__nochildren: {
         stb__nochildren *n = (stb__nochildren *) p - 1;
         if (n->prevn)
            assert(*n->prevn == p);
         if (n->next) {
            assert(*stb__prevn(n->next) == &n->next);
            stb_malloc_validate(n, parent);
         }
         return;
      }
      case STB__alloc: {
         stb__alloc *s = (stb__alloc *) p - 1;

         if (s->prevn)
            assert(*s->prevn == p);

         if (s->child) {
            assert(*stb__prevn(s->child) == &s->child);
            stb_malloc_validate(s->child, p);
         }

         if (s->next) {
            assert(*stb__prevn(s->next) == &s->next);
            stb_malloc_validate(s->next, parent);
         }
         return;
      }
      default:
         assert(0); /* NOTREACHED */
   }
}

static void * stb__try_chunk(stb__chunk *c, int size, int align, int pre_align)
{
   char *memblock = (char *) (c+1), *q;
   stb_inta iq;
   int start_offset;

   // we going to allocate at the end of the chunk, not the start. confusing,
   // but it means we don't need both a 'limit' and a 'cur', just a 'cur'.
   // the block ends at: p + c->data_left
   //   then we move back by size
   start_offset = c->data_left - size;

   // now we need to check the alignment of that
   q = memblock + start_offset;
   iq = (stb_inta) q;
   assert(sizeof(q) == sizeof(iq));

   // suppose align = 2
   // then we need to retreat iq far enough that (iq & (2-1)) == 0
   // to get (iq & (align-1)) = 0 requires subtracting (iq & (align-1))

   start_offset -= iq & (align-1);
   assert(((stb_uinta) (memblock+start_offset) & (align-1)) == 0);

   // now, if that + pre_align works, go for it!
   start_offset -= pre_align;

   if (start_offset >= 0) {
      c->data_left = start_offset;
      return memblock + start_offset;
   }

   return NULL;
}

static void stb__sort_chunks(stb__alloc *src)
{
   // of the first two chunks, put the chunk with more data left in it first
   stb__chunk *c = stb__chunks(src), *d;
   if (c == NULL) return;
   d = c->next;
   if (d == NULL) return;
   if (c->data_left > d->data_left) return;

   c->next = d->next;
   d->next = c;
   stb__setchunks(src, d);
}

static void * stb__alloc_chunk(stb__alloc *src, int size, int align, int pre_align)
{
   void *p;
   stb__chunk *c = stb__chunks(src);

   if (c && size <= stb_alloc_chunk_size) {

      p = stb__try_chunk(c, size, align, pre_align);
      if (p) { ++c->alloc; return p; }

      // try a second chunk to reduce wastage
      if (c->next) {
         p = stb__try_chunk(c->next, size, align, pre_align);
         if (p) { ++c->alloc; return p; }

         // put the bigger chunk first, since the second will get buried
         // the upshot of this is that, until it gets allocated from, chunk #2
         // is always the largest remaining chunk. (could formalize
         // this with a heap!)
         stb__sort_chunks(src);
         c = stb__chunks(src);
      }
   }

   // allocate a new chunk
   {
      stb__chunk *n;

      int chunk_size = stb_alloc_chunk_size;
      // we're going to allocate a new chunk to put this in
      if (size > chunk_size)
         chunk_size = size;

      assert(sizeof(*n) + pre_align <= 16);

      // loop trying to allocate a large enough chunk
      // the loop is because the alignment may cause problems if it's big...
      // and we don't know what our chunk alignment is going to be
      while (1) {
         n = (stb__chunk *) malloc(16 + chunk_size);
         if (n == NULL) return NULL;

         n->data_left = chunk_size - sizeof(*n);

         p = stb__try_chunk(n, size, align, pre_align);
         if (p != NULL) {
            n->next = c;
            stb__setchunks(src, n);

            // if we just used up the whole block immediately,
            // move the following chunk up
            n->alloc = 1;
            if (size == chunk_size)
               stb__sort_chunks(src);

            return p;
         }

         free(n);
         chunk_size += 16+align;
      }
   }
}

static stb__alloc * stb__get_context(void *context)
{
   if (context == NULL) {
      return &stb__alloc_global;
   } else {
      int u = stb__identify(context);
      // if context is chunked, grab parent
      if (u == STB__chunked) {
         stb__chunked *s = (stb__chunked *) context - 1;
         return stb__parent(s);
      } else {
         return (stb__alloc *) context - 1;
      }
   }
}

static void stb__insert_alloc(stb__alloc *src, stb__alloc *s)
{
   s->prevn = &src->child;
   s->next  = src->child;
   src->child = s+1;
   if (s->next)
      *stb__prevn(s->next) = &s->next;
}

static void stb__insert_nochild(stb__alloc *src, stb__nochildren *s)
{
   s->prevn = &src->child;
   s->next  = src->child;
   src->child = s+1;
   if (s->next)
      *stb__prevn(s->next) = &s->next;
}

static void * malloc_base(void *context, size_t size, stb__alloc_type t, int align)
{
   void *p;

   stb__alloc *src = stb__get_context(context);

   if (align <= 0) {
      // compute worst-case C packed alignment
      // e.g. a 24-byte struct is 8-aligned
      int align_proposed = 1 << stb_lowbit8((unsigned int) size);

      if (align_proposed < 0)
         align_proposed = 4;

      if (align_proposed == 0) {
         if (size == 0)
            align_proposed = 1;
         else
            align_proposed = 256;
      }

      // a negative alignment means 'don't align any larger
      // than this'; so -16 means we align 1,2,4,8, or 16

      if (align < 0) {
         if (align_proposed > -align)
            align_proposed = -align;
      }

      align = align_proposed;
   }

   assert(stb_is_pow2(align));

   // don't cause misalignment when allocating nochildren
   if (t == STB__nochildren && align > 8)
      t = STB__alloc;

   switch (t) {
      case STB__alloc: {
         stb__alloc *s = (stb__alloc *) malloc(size + sizeof(*s));
         if (s == NULL) return NULL;
         p = s+1;
         s->child = NULL;
         stb__insert_alloc(src, s);

         stb__setchunks(s,NULL);
         break;
      }

      case STB__nochildren: {
         stb__nochildren *s = (stb__nochildren *) malloc(size + sizeof(*s));
         if (s == NULL) return NULL;
         p = s+1;
         stb__insert_nochild(src, s);
         break;
      }

      case STB__chunk_raw: {
         p = stb__alloc_chunk(src, (int) size, align, 0);
         if (p == NULL) return NULL;
         break;
      }

      case STB__chunked: {
         stb__chunked *s;
         if (align < sizeof(stb_uintptr)) align = sizeof(stb_uintptr);
         s = (stb__chunked *) stb__alloc_chunk(src, (int) size, align, sizeof(*s));
         if (s == NULL) return NULL;
         stb__setparent(s, src);
         p = s+1;
         break;
      }

      default: p = NULL; assert(0); /* NOTREACHED */
   }

   ++stb_alloc_count_alloc;
   return p;
}

void *stb_malloc_global(size_t size)
{
   return malloc_base(NULL, size, STB__alloc, stb_alloc_alignment);
}

void *stb_malloc(void *context, size_t size)
{
   return malloc_base(context, size, STB__alloc, stb_alloc_alignment);
}

void *stb_malloc_nofree(void *context, size_t size)
{
   return malloc_base(context, size, STB__chunked, stb_alloc_alignment);
}

void *stb_malloc_leaf(void *context, size_t size)
{
   return malloc_base(context, size, STB__nochildren, stb_alloc_alignment);
}

void *stb_malloc_raw(void *context, size_t size)
{
   return malloc_base(context, size, STB__chunk_raw, stb_alloc_alignment);
}

char *stb_malloc_string(void *context, size_t size)
{
   return (char *) malloc_base(context, size, STB__chunk_raw, 1);
}

void *stb_realloc(void *ptr, size_t newsize)
{
   stb__alloc_type t;

   if (ptr == NULL) return stb_malloc(NULL, newsize);
   if (newsize == 0) { stb_free(ptr); return NULL; }

   t = stb__identify(ptr);
   assert(t == STB__alloc || t == STB__nochildren);

   if (t == STB__alloc) {
      stb__alloc *s = (stb__alloc *) ptr - 1;

      s = (stb__alloc *) realloc(s, newsize + sizeof(*s));
      if (s == NULL) return NULL;

      ptr = s+1;

      // update pointers
      (*s->prevn) = ptr;
      if (s->next)
         *stb__prevn(s->next) = &s->next;

      if (s->child)
         *stb__prevn(s->child) = &s->child;

      return ptr;
   } else {
      stb__nochildren *s = (stb__nochildren *) ptr - 1;

      s = (stb__nochildren *) realloc(ptr, newsize + sizeof(s));
      if (s == NULL) return NULL;

      // update pointers
      (*s->prevn) = s+1;
      if (s->next)
         *stb__prevn(s->next) = &s->next;

      return s+1;
   }
}

void *stb_realloc_c(void *context, void *ptr, size_t newsize)
{
   if (ptr == NULL) return stb_malloc(context, newsize);
   if (newsize == 0) { stb_free(ptr); return NULL; }
   // @TODO: verify you haven't changed contexts
   return stb_realloc(ptr, newsize);
}

void stb_reassign(void *new_context, void *ptr)
{
   stb__alloc *src = stb__get_context(new_context);

   stb__alloc_type t = stb__identify(ptr);
   assert(t == STB__alloc || t == STB__nochildren);

   if (t == STB__alloc) {
      stb__alloc *s = (stb__alloc *) ptr - 1;

      // unlink from old
      *(s->prevn) = s->next;
      if (s->next)
         *stb__prevn(s->next) = s->prevn;

      stb__insert_alloc(src, s);
   } else {
      stb__nochildren *s = (stb__nochildren *) ptr - 1;

      // unlink from old
      *(s->prevn) = s->next;
      if (s->next)
         *stb__prevn(s->next) = s->prevn;

      stb__insert_nochild(src, s);
   }
}

#endif


//////////////////////////////////////////////////////////////////////////////
//
//                                stb_arr
//
//  An stb_arr is directly useable as a pointer (use the actual type in your
//  definition), but when it resizes, it returns a new pointer and you can't
//  use the old one, so you have to be careful to copy-in-out as necessary.
//
//  Use a NULL pointer as a 0-length array.
//
//     float *my_array = NULL, *temp;
//
//     // add elements on the end one at a time
//     stb_arr_push(my_array, 0.0f);
//     stb_arr_push(my_array, 1.0f);
//     stb_arr_push(my_array, 2.0f);
//
//     assert(my_array[1] == 2.0f);
//
//     // add an uninitialized element at the end, then assign it
//     *stb_arr_add(my_array) = 3.0f;
//
//     // add three uninitialized elements at the end
//     temp = stb_arr_addn(my_array,3);
//     temp[0] = 4.0f;
//     temp[1] = 5.0f;
//     temp[2] = 6.0f;
//
//     assert(my_array[5] == 5.0f);
//
//     // remove the last one
//     stb_arr_pop(my_array);
//
//     assert(stb_arr_len(my_array) == 6);


#ifdef STB_MALLOC_WRAPPER
  #define STB__PARAMS    , char *file, int line
  #define STB__ARGS      ,       file,     line
#else
  #define STB__PARAMS
  #define STB__ARGS
#endif

// calling this function allocates an empty stb_arr attached to p
// (whereas NULL isn't attached to anything)
STB_EXTERN void stb_arr_malloc(void **target, void *context);

// call this function with a non-NULL value to have all successive
// stbs that are created be attached to the associated parent. Note
// that once a given stb_arr is non-empty, it stays attached to its
// current parent, even if you call this function again.
// it turns the previous value, so you can restore it
STB_EXTERN void* stb_arr_malloc_parent(void *p);

// simple functions written on top of other functions
#define stb_arr_empty(a)       (  stb_arr_len(a) == 0 )
#define stb_arr_add(a)         (  stb_arr_addn((a),1) )
#define stb_arr_push(a,v)      ( *stb_arr_add(a)=(v)  )

typedef struct
{
   int len, limit;
   int stb_malloc;
   unsigned int signature;
} stb__arr;

#define stb_arr_signature      0x51bada7b  // ends with 0123 in decimal

// access the header block stored before the data
#define stb_arrhead(a)         /*lint --e(826)*/ (((stb__arr *) (a)) - 1)
#define stb_arrhead2(a)        /*lint --e(826)*/ (((stb__arr *) (a)) - 1)

#ifdef STB_DEBUG
#define stb_arr_check(a)       assert(!a || stb_arrhead(a)->signature == stb_arr_signature)
#define stb_arr_check2(a)      assert(!a || stb_arrhead2(a)->signature == stb_arr_signature)
#else
#define stb_arr_check(a)       ((void) 0)
#define stb_arr_check2(a)      ((void) 0)
#endif

// ARRAY LENGTH

// get the array length; special case if pointer is NULL
#define stb_arr_len(a)         (a ? stb_arrhead(a)->len : 0)
#define stb_arr_len2(a)        ((stb__arr *) (a) ? stb_arrhead2(a)->len : 0)
#define stb_arr_lastn(a)       (stb_arr_len(a)-1)

// check whether a given index is valid -- tests 0 <= i < stb_arr_len(a)
#define stb_arr_valid(a,i)     (a ? (int) (i) < stb_arrhead(a)->len : 0)

// change the array length so is is exactly N entries long, creating
// uninitialized entries as needed
#define stb_arr_setlen(a,n)  \
            (stb__arr_setlen((void **) &(a), sizeof(a[0]), (n)))

// change the array length so that N is a valid index (that is, so
// it is at least N entries long), creating uninitialized entries as needed
#define stb_arr_makevalid(a,n)  \
            (stb_arr_len(a) < (n)+1 ? stb_arr_setlen(a,(n)+1),(a) : (a))

// remove the last element of the array, returning it
#define stb_arr_pop(a)         ((stb_arr_check(a), (a))[--stb_arrhead(a)->len])

// access the last element in the array
#define stb_arr_last(a)        ((stb_arr_check(a), (a))[stb_arr_len(a)-1])

// is iterator at end of list?
#define stb_arr_end(a,i)       ((i) >= &(a)[stb_arr_len(a)])

// (internal) change the allocated length of the array
#define stb_arr__grow(a,n)     (stb_arr_check(a), stb_arrhead(a)->len += (n))

// add N new uninitialized elements to the end of the array
#define stb_arr__addn(a,n)     /*lint --e(826)*/ \
                               ((stb_arr_len(a)+(n) > stb_arrcurmax(a))      \
                                 ? (stb__arr_addlen((void **) &(a),sizeof(*a),(n)),0) \
                                 : ((stb_arr__grow(a,n), 0)))

// add N new uninitialized elements to the end of the array, and return
// a pointer to the first new one
#define stb_arr_addn(a,n)      (stb_arr__addn((a),n),(a)+stb_arr_len(a)-(n))

// add N new uninitialized elements starting at index 'i'
#define stb_arr_insertn(a,i,n) (stb__arr_insertn((void **) &(a), sizeof(*a), (i), (n)))

// insert an element at i
#define stb_arr_insert(a,i,v)  (stb__arr_insertn((void **) &(a), sizeof(*a), (i), (1)), ((a)[i] = v))

// delete N elements from the middle starting at index 'i'
#define stb_arr_deleten(a,i,n) (stb__arr_deleten((void **) &(a), sizeof(*a), (i), (n)))

// delete the i'th element
#define stb_arr_delete(a,i)   stb_arr_deleten(a,i,1)

// delete the i'th element, swapping down from the end
#define stb_arr_fastdelete(a,i)  \
   (stb_swap(&a[i], &a[stb_arrhead(a)->len-1], sizeof(*a)), stb_arr_pop(a))


// ARRAY STORAGE

// get the array maximum storage; special case if NULL
#define stb_arrcurmax(a)       (a ? stb_arrhead(a)->limit : 0)
#define stb_arrcurmax2(a)      (a ? stb_arrhead2(a)->limit : 0)

// set the maxlength of the array to n in anticipation of further growth
#define stb_arr_setsize(a,n)   (stb_arr_check(a), stb__arr_setsize((void **) &(a),sizeof((a)[0]),n))

// make sure maxlength is large enough for at least N new allocations
#define stb_arr_atleast(a,n)   (stb_arr_len(a)+(n) > stb_arrcurmax(a)      \
                                 ? stb_arr_setsize((a), (n)) : 0)

// make a copy of a given array (copies contents via 'memcpy'!)
#define stb_arr_copy(a)        stb__arr_copy(a, sizeof((a)[0]))

// compute the storage needed to store all the elements of the array
#define stb_arr_storage(a)     (stb_arr_len(a) * sizeof((a)[0]))

#define stb_arr_for(v,arr)     for((v)=(arr); (v) < (arr)+stb_arr_len(arr); ++(v))

// IMPLEMENTATION

STB_EXTERN void stb_arr_free_(void **p);
STB_EXTERN void *stb__arr_copy_(void *p, int elem_size);
STB_EXTERN void stb__arr_setsize_(void **p, int size, int limit  STB__PARAMS);
STB_EXTERN void stb__arr_setlen_(void **p, int size, int newlen  STB__PARAMS);
STB_EXTERN void stb__arr_addlen_(void **p, int size, int addlen  STB__PARAMS);
STB_EXTERN void stb__arr_deleten_(void **p, int size, int loc, int n  STB__PARAMS);
STB_EXTERN void stb__arr_insertn_(void **p, int size, int loc, int n  STB__PARAMS);

#define stb_arr_free(p)            stb_arr_free_((void **) &(p))
#define stb__arr_copy              stb__arr_copy_

#ifndef STB_MALLOC_WRAPPER
  #define stb__arr_setsize         stb__arr_setsize_
  #define stb__arr_setlen          stb__arr_setlen_
  #define stb__arr_addlen          stb__arr_addlen_
  #define stb__arr_deleten         stb__arr_deleten_
  #define stb__arr_insertn         stb__arr_insertn_
#else
  #define stb__arr_addlen(p,s,n)    stb__arr_addlen_(p,s,n,__FILE__,__LINE__)
  #define stb__arr_setlen(p,s,n)    stb__arr_setlen_(p,s,n,__FILE__,__LINE__)
  #define stb__arr_setsize(p,s,n)   stb__arr_setsize_(p,s,n,__FILE__,__LINE__)
  #define stb__arr_deleten(p,s,i,n) stb__arr_deleten_(p,s,i,n,__FILE__,__LINE__)
  #define stb__arr_insertn(p,s,i,n) stb__arr_insertn_(p,s,i,n,__FILE__,__LINE__)
#endif

#ifdef STB_DEFINE
static void *stb__arr_context;

void *stb_arr_malloc_parent(void *p)
{
   void *q = stb__arr_context;
   stb__arr_context = p;
   return q;
}

void stb_arr_malloc(void **target, void *context)
{
   stb__arr *q = (stb__arr *) stb_malloc(context, sizeof(*q));
   q->len = q->limit = 0;
   q->stb_malloc = 1;
   q->signature = stb_arr_signature;
   *target = (void *) (q+1);
}

static void * stb__arr_malloc(int size)
{
   if (stb__arr_context)
      return stb_malloc(stb__arr_context, size);
   return malloc(size);
}

void * stb__arr_copy_(void *p, int elem_size)
{
   stb__arr *q;
   if (p == NULL) return p;
   q = (stb__arr *) stb__arr_malloc(sizeof(*q) + elem_size * stb_arrhead2(p)->limit);
   stb_arr_check2(p);
   memcpy(q, stb_arrhead2(p), sizeof(*q) + elem_size * stb_arrhead2(p)->len);
   q->stb_malloc = !!stb__arr_context;
   return q+1;
}

void stb_arr_free_(void **pp)
{
   void *p = *pp;
   stb_arr_check2(p);
   if (p) {
      stb__arr *q = stb_arrhead2(p);
      if (q->stb_malloc)
         stb_free(q);
      else
         free(q);
   }
   *pp = NULL;
}

static void stb__arrsize_(void **pp, int size, int limit, int len  STB__PARAMS)
{
   void *p = *pp;
   stb__arr *a;
   stb_arr_check2(p);
   if (p == NULL) {
      if (len == 0 && size == 0) return;
      a = (stb__arr *) stb__arr_malloc(sizeof(*a) + size*limit);
      a->limit = limit;
      a->len   = len;
      a->stb_malloc = !!stb__arr_context;
      a->signature = stb_arr_signature;
   } else {
      a = stb_arrhead2(p);
      a->len = len;
      if (a->limit < limit) {
         void *p;
         if (a->limit >= 4 && limit < a->limit * 2)
            limit = a->limit * 2;
         if (a->stb_malloc)
            p = stb_realloc(a, sizeof(*a) + limit*size);
         else
            #ifdef STB_MALLOC_WRAPPER
            p = stb__realloc(a, sizeof(*a) + limit*size, file, line);
            #else
            p = realloc(a, sizeof(*a) + limit*size);
            #endif
         if (p) {
            a = (stb__arr *) p;
            a->limit = limit;
         } else {
            // throw an error!
         }
      }
   }
   a->len   = stb_min(a->len, a->limit);
   *pp = a+1;
}

void stb__arr_setsize_(void **pp, int size, int limit  STB__PARAMS)
{
   void *p = *pp;
   stb_arr_check2(p);
   stb__arrsize_(pp, size, limit, stb_arr_len2(p)  STB__ARGS);
}

void stb__arr_setlen_(void **pp, int size, int newlen  STB__PARAMS)
{
   void *p = *pp;
   stb_arr_check2(p);
   if (stb_arrcurmax2(p) < newlen || p == NULL) {
      stb__arrsize_(pp, size, newlen, newlen  STB__ARGS);
   } else {
      stb_arrhead2(p)->len = newlen;
   }
}

void stb__arr_addlen_(void **p, int size, int addlen  STB__PARAMS)
{
   stb__arr_setlen_(p, size, stb_arr_len2(*p) + addlen  STB__ARGS);
}

void stb__arr_insertn_(void **pp, int size, int i, int n  STB__PARAMS)
{
   void *p = *pp;
   if (n) {
      int z;

      if (p == NULL) {
         stb__arr_addlen_(pp, size, n  STB__ARGS);
         return;
      }

      z = stb_arr_len2(p);
      stb__arr_addlen_(&p, size, n  STB__ARGS);
      memmove((char *) p + (i+n)*size, (char *) p + i*size, size * (z-i));
   }
   *pp = p;
}

void stb__arr_deleten_(void **pp, int size, int i, int n  STB__PARAMS)
{
   void *p = *pp;
   if (n) {
      memmove((char *) p + i*size, (char *) p + (i+n)*size, size * (stb_arr_len2(p)-(i+n)));
      stb_arrhead2(p)->len -= n;
   }
   *pp = p;
}

#endif

//////////////////////////////////////////////////////////////////////////////
//
//                               Hashing
//
//      typical use for this is to make a power-of-two hash table.
//
//      let N = size of table (2^n)
//      let H = stb_hash(str)
//      let S = stb_rehash(H) | 1
//
//      then hash probe sequence P(i) for i=0..N-1
//         P(i) = (H + S*i) & (N-1)
//
//      the idea is that H has 32 bits of hash information, but the
//      table has only, say, 2^20 entries so only uses 20 of the bits.
//      then by rehashing the original H we get 2^12 different probe
//      sequences for a given initial probe location. (So it's optimal
//      for 64K tables and its optimality decreases past that.)
//
//      ok, so I've added something that generates _two separate_
//      32-bit hashes simultaneously which should scale better to
//      very large tables.


STB_EXTERN unsigned int stb_hash(char *str);
STB_EXTERN unsigned int stb_hashptr(void *p);
STB_EXTERN unsigned int stb_hashlen(char *str, int len);
STB_EXTERN unsigned int stb_rehash_improved(unsigned int v);
STB_EXTERN unsigned int stb_hash_fast(void *p, int len);
STB_EXTERN unsigned int stb_hash2(char *str, unsigned int *hash2_ptr);
STB_EXTERN unsigned int stb_hash_number(unsigned int hash);

#define stb_rehash(x)  ((x) + ((x) >> 6) + ((x) >> 19))

#ifdef STB_DEFINE
unsigned int stb_hash(char *str)
{
   unsigned int hash = 0;
   while (*str)
      hash = (hash << 7) + (hash >> 25) + *str++;
   return hash + (hash >> 16);
}

unsigned int stb_hashlen(char *str, int len)
{
   unsigned int hash = 0;
   while (len-- > 0 && *str)
      hash = (hash << 7) + (hash >> 25) + *str++;
   return hash + (hash >> 16);
}

unsigned int stb_hashptr(void *p)
{
    unsigned int x = (unsigned int)(size_t) p;

   // typically lacking in low bits and high bits
   x = stb_rehash(x);
   x += x << 16;

   // pearson's shuffle
   x ^= x << 3;
   x += x >> 5;
   x ^= x << 2;
   x += x >> 15;
   x ^= x << 10;
   return stb_rehash(x);
}

unsigned int stb_rehash_improved(unsigned int v)
{
   return stb_hashptr((void *)(size_t) v);
}

unsigned int stb_hash2(char *str, unsigned int *hash2_ptr)
{
   unsigned int hash1 = 0x3141592c;
   unsigned int hash2 = 0x77f044ed;
   while (*str) {
      hash1 = (hash1 << 7) + (hash1 >> 25) + *str;
      hash2 = (hash2 << 11) + (hash2 >> 21) + *str;
      ++str;
   }
   *hash2_ptr = hash2 + (hash1 >> 16);
   return       hash1 + (hash2 >> 16);
}

// Paul Hsieh hash
#define stb__get16(p) ((p)[0] | ((p)[1] << 8))

unsigned int stb_hash_fast(void *p, int len)
{
   unsigned char *q = (unsigned char *) p;
   unsigned int hash = len;

   if (len <= 0 || q == NULL) return 0;

   /* Main loop */
   for (;len > 3; len -= 4) {
      unsigned int val;
      hash +=  stb__get16(q);
      val   = (stb__get16(q+2) << 11);
      hash  = (hash << 16) ^ hash ^ val;
      q    += 4;
      hash += hash >> 11;
   }

   /* Handle end cases */
   switch (len) {
      case 3: hash += stb__get16(q);
              hash ^= hash << 16;
              hash ^= q[2] << 18;
              hash += hash >> 11;
              break;
      case 2: hash += stb__get16(q);
              hash ^= hash << 11;
              hash += hash >> 17;
              break;
      case 1: hash += q[0];
              hash ^= hash << 10;
              hash += hash >> 1;
              break;
      case 0: break;
   }

   /* Force "avalanching" of final 127 bits */
   hash ^= hash << 3;
   hash += hash >> 5;
   hash ^= hash << 4;
   hash += hash >> 17;
   hash ^= hash << 25;
   hash += hash >> 6;

   return hash;
}

unsigned int stb_hash_number(unsigned int hash)
{
   hash ^= hash << 3;
   hash += hash >> 5;
   hash ^= hash << 4;
   hash += hash >> 17;
   hash ^= hash << 25;
   hash += hash >> 6;
   return hash;
}

#endif

#ifdef STB_PERFECT_HASH
//////////////////////////////////////////////////////////////////////////////
//
//                     Perfect hashing for ints/pointers
//
//   This is mainly useful for making faster pointer-indexed tables
//   that don't change frequently. E.g. for stb_ischar().
//

typedef struct
{
   stb_uint32  addend;
   stb_uint    multiplicand;
   stb_uint    b_mask;
   stb_uint8   small_bmap[16];
   stb_uint16  *large_bmap;

   stb_uint table_mask;
   stb_uint32 *table;
} stb_perfect;

STB_EXTERN int stb_perfect_create(stb_perfect *,unsigned int*,int n);
STB_EXTERN void stb_perfect_destroy(stb_perfect *);
STB_EXTERN int stb_perfect_hash(stb_perfect *, unsigned int x);
extern int stb_perfect_hash_max_failures;

#ifdef STB_DEFINE

int stb_perfect_hash_max_failures;

int stb_perfect_hash(stb_perfect *p, unsigned int x)
{
   stb_uint m = x * p->multiplicand;
   stb_uint y = x >> 16;
   stb_uint bv = (m >> 24) + y;
   stb_uint av = (m + y) >> 12;
   if (p->table == NULL) return -1;  // uninitialized table fails
   bv &= p->b_mask;
   av &= p->table_mask;
   if (p->large_bmap)
      av ^= p->large_bmap[bv];
   else
      av ^= p->small_bmap[bv];
   return p->table[av] == x ? av : -1;
}

static void stb__perfect_prehash(stb_perfect *p, stb_uint x, stb_uint16 *a, stb_uint16 *b)
{
   stb_uint m = x * p->multiplicand;
   stb_uint y = x >> 16;
   stb_uint bv = (m >> 24) + y;
   stb_uint av = (m + y) >> 12;
   bv &= p->b_mask;
   av &= p->table_mask;
   *b = bv;
   *a = av;
}

static unsigned long stb__perfect_rand(void)
{
   static unsigned long stb__rand;
   stb__rand = stb__rand * 2147001325 + 715136305;
   return 0x31415926 ^ ((stb__rand >> 16) + (stb__rand << 16));
}

typedef struct {
   unsigned short count;
   unsigned short b;
   unsigned short map;
   unsigned short *entries;
} stb__slot;

static int stb__slot_compare(const void *p, const void *q)
{
   stb__slot *a = (stb__slot *) p;
   stb__slot *b = (stb__slot *) q;
   return a->count > b->count ? -1 : a->count < b->count;  // sort large to small
}

int stb_perfect_create(stb_perfect *p, unsigned int *v, int n)
{
   unsigned int buffer1[64], buffer2[64], buffer3[64], buffer4[64], buffer5[32];
   unsigned short *as = (unsigned short *) stb_temp(buffer1, sizeof(*v)*n);
   unsigned short *bs = (unsigned short *) stb_temp(buffer2, sizeof(*v)*n);
   unsigned short *entries = (unsigned short *) stb_temp(buffer4, sizeof(*entries) * n);
   int size = 1 << stb_log2_ceil(n), bsize=8;
   int failure = 0,i,j,k;

   assert(n <= 32768);
   p->large_bmap = NULL;

   for(;;) {
      stb__slot *bcount = (stb__slot *) stb_temp(buffer3, sizeof(*bcount) * bsize);
      unsigned short *bloc = (unsigned short *) stb_temp(buffer5, sizeof(*bloc) * bsize);
      unsigned short *e;
      int bad=0;

      p->addend = stb__perfect_rand();
      p->multiplicand = stb__perfect_rand() | 1;
      p->table_mask = size-1;
      p->b_mask = bsize-1;
      p->table = (stb_uint32 *) malloc(size * sizeof(*p->table));

      for (i=0; i < bsize; ++i) {
         bcount[i].b     = i;
         bcount[i].count = 0;
         bcount[i].map   = 0;
      }
      for (i=0; i < n; ++i) {
         stb__perfect_prehash(p, v[i], as+i, bs+i);
         ++bcount[bs[i]].count;
      }
      qsort(bcount, bsize, sizeof(*bcount), stb__slot_compare);
      e = entries; // now setup up their entries index
      for (i=0; i < bsize; ++i) {
         bcount[i].entries = e;
         e += bcount[i].count;
         bcount[i].count = 0;
         bloc[bcount[i].b] = i;
      }
      // now fill them out
      for (i=0; i < n; ++i) {
         int b = bs[i];
         int w = bloc[b];
         bcount[w].entries[bcount[w].count++] = i;
      }
      stb_tempfree(buffer5,bloc);
      // verify
      for (i=0; i < bsize; ++i)
         for (j=0; j < bcount[i].count; ++j)
            assert(bs[bcount[i].entries[j]] == bcount[i].b);
      memset(p->table, 0, size*sizeof(*p->table));

      // check if any b has duplicate a
      for (i=0; i < bsize; ++i) {
         if (bcount[i].count > 1) {
            for (j=0; j < bcount[i].count; ++j) {
               if (p->table[as[bcount[i].entries[j]]])
                  bad = 1;
               p->table[as[bcount[i].entries[j]]] = 1;
            }
            for (j=0; j < bcount[i].count; ++j) {
               p->table[as[bcount[i].entries[j]]] = 0;
            }
            if (bad) break;
         }
      }

      if (!bad) {
         // go through the bs and populate the table, first fit
         for (i=0; i < bsize; ++i) {
            if (bcount[i].count) {
               // go through the candidate table[b] values
               for (j=0; j < size; ++j) {
                  // go through the a values and see if they fit
                  for (k=0; k < bcount[i].count; ++k) {
                     int a = as[bcount[i].entries[k]];
                     if (p->table[(a^j)&p->table_mask]) {
                        break; // fails
                     }
                  }
                  // if succeeded, accept
                  if (k == bcount[i].count) {
                     bcount[i].map = j;
                     for (k=0; k < bcount[i].count; ++k) {
                        int a = as[bcount[i].entries[k]];
                        p->table[(a^j)&p->table_mask] = 1;
                     }
                     break;
                  }
               }
               if (j == size)
                  break; // no match for i'th entry, so break out in failure
            }
         }
         if (i == bsize) {
            // success... fill out map
            if (bsize <= 16 && size <= 256) {
               p->large_bmap = NULL;
               for (i=0; i < bsize; ++i)
                  p->small_bmap[bcount[i].b] = (stb_uint8) bcount[i].map;
            } else {
               p->large_bmap = (unsigned short *) malloc(sizeof(*p->large_bmap) * bsize);
               for (i=0; i < bsize; ++i)
                  p->large_bmap[bcount[i].b] = bcount[i].map;
            }

            // initialize table to v[0], so empty slots will fail
            for (i=0; i < size; ++i)
               p->table[i] = v[0];

            for (i=0; i < n; ++i)
               if (p->large_bmap)
                  p->table[as[i] ^ p->large_bmap[bs[i]]] = v[i];
               else
                  p->table[as[i] ^ p->small_bmap[bs[i]]] = v[i];

            // and now validate that none of them collided
            for (i=0; i < n; ++i)
               assert(stb_perfect_hash(p, v[i]) >= 0);

            stb_tempfree(buffer3, bcount);
            break;
         }
      }
      free(p->table);
      p->table = NULL;
      stb_tempfree(buffer3, bcount);

      ++failure;
      if (failure >= 4 && bsize < size) bsize *= 2;
      if (failure >= 8 && (failure & 3) == 0 && size < 4*n) {
         size *= 2;
         bsize *= 2;
      }
      if (failure == 6) {
         // make sure the input data is unique, so we don't infinite loop
         unsigned int *data = (unsigned int *) stb_temp(buffer3, n * sizeof(*data));
         memcpy(data, v, sizeof(*data) * n);
         qsort(data, n, sizeof(*data), stb_intcmp(0));
         for (i=1; i < n; ++i) {
            if (data[i] == data[i-1])
               size = 0; // size is return value, so 0 it
         }
         stb_tempfree(buffer3, data);
         if (!size) break;
      }
   }

   if (failure > stb_perfect_hash_max_failures)
      stb_perfect_hash_max_failures = failure;

   stb_tempfree(buffer1, as);
   stb_tempfree(buffer2, bs);
   stb_tempfree(buffer4, entries);

   return size;
}

void stb_perfect_destroy(stb_perfect *p)
{
   if (p->large_bmap) free(p->large_bmap);
   if (p->table     ) free(p->table);
   p->large_bmap = NULL;
   p->table      = NULL;
   p->b_mask     = 0;
   p->table_mask = 0;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                     Perfect hash clients

STB_EXTERN int    stb_ischar(char s, char *set);

#ifdef STB_DEFINE

int stb_ischar(char c, char *set)
{
   static unsigned char bit[8] = { 1,2,4,8,16,32,64,128 };
   static stb_perfect p;
   static unsigned char (*tables)[256];
   static char ** sets = NULL;

   int z = stb_perfect_hash(&p, (int)(size_t) set);
   if (z < 0) {
      int i,k,n,j,f;
      // special code that means free all existing data
      if (set == NULL) {
         stb_arr_free(sets);
         free(tables);
         tables = NULL;
         stb_perfect_destroy(&p);
         return 0;
      }
      stb_arr_push(sets, set);
      stb_perfect_destroy(&p);
      n = stb_perfect_create(&p, (unsigned int *) (char **) sets, stb_arr_len(sets));
      assert(n != 0);
      k = (n+7) >> 3;
      tables = (unsigned char (*)[256]) realloc(tables, sizeof(*tables) * k);
      memset(tables, 0, sizeof(*tables) * k);
      for (i=0; i < stb_arr_len(sets); ++i) {
          k = stb_perfect_hash(&p, (int)(size_t) sets[i]);
         assert(k >= 0);
         n = k >> 3;
         f = bit[k&7];
         for (j=0; !j || sets[i][j]; ++j) {
            tables[n][(unsigned char) sets[i][j]] |= f;
         }
      }
      z = stb_perfect_hash(&p, (int)(size_t) set);
   }
   return tables[z >> 3][(unsigned char) c] & bit[z & 7];
}

#endif
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                     Instantiated data structures
//
// This is an attempt to implement a templated data structure.
//
// Hash table: call stb_define_hash(TYPE,N,KEY,K1,K2,HASH,VALUE)
//     TYPE     -- will define a structure type containing the hash table
//     N        -- the name, will prefix functions named:
//                        N create
//                        N destroy
//                        N get
//                        N set, N add, N update,
//                        N remove
//     KEY      -- the type of the key. 'x == y' must be valid
//       K1,K2  -- keys never used by the app, used as flags in the hashtable
//       HASH   -- a piece of code ending with 'return' that hashes key 'k'
//     VALUE    -- the type of the value. 'x = y' must be valid
//
//  Note that stb_define_hash_base can be used to define more sophisticated
//  hash tables, e.g. those that make copies of the key or use special
//  comparisons (e.g. strcmp).

#define STB_(prefix,name)     stb__##prefix##name
#define STB__(prefix,name)    prefix##name
#define STB__use(x)           x
#define STB__skip(x)

#define stb_declare_hash(PREFIX,TYPE,N,KEY,VALUE) \
   typedef struct stb__st_##TYPE TYPE;\
   PREFIX int STB__(N, init)(TYPE *h, int count);\
   PREFIX int STB__(N, memory_usage)(TYPE *h);\
   PREFIX TYPE * STB__(N, create)(void);\
   PREFIX TYPE * STB__(N, copy)(TYPE *h);\
   PREFIX void STB__(N, destroy)(TYPE *h);\
   PREFIX int STB__(N,get_flag)(TYPE *a, KEY k, VALUE *v);\
   PREFIX VALUE STB__(N,get)(TYPE *a, KEY k);\
   PREFIX int STB__(N, set)(TYPE *a, KEY k, VALUE v);\
   PREFIX int STB__(N, add)(TYPE *a, KEY k, VALUE v);\
   PREFIX int STB__(N, update)(TYPE*a,KEY k,VALUE v);\
   PREFIX int STB__(N, remove)(TYPE *a, KEY k, VALUE *v);

#define STB_nocopy(x)        (x)
#define STB_nodelete(x)      0
#define STB_nofields
#define STB_nonullvalue(x)
#define STB_nullvalue(x)     x
#define STB_safecompare(x)   x
#define STB_nosafe(x)
#define STB_noprefix

#ifdef __GNUC__
#define STB__nogcc(x)
#else
#define STB__nogcc(x)  x
#endif

#define stb_define_hash_base(PREFIX,TYPE,FIELDS,N,NC,LOAD_FACTOR,             \
                             KEY,EMPTY,DEL,COPY,DISPOSE,SAFE,                 \
                             VCOMPARE,CCOMPARE,HASH,                          \
                             VALUE,HASVNULL,VNULL)                            \
                                                                              \
typedef struct                                                                \
{                                                                             \
   KEY   k;                                                                   \
   VALUE v;                                                                   \
} STB_(N,_hashpair);                                                          \
                                                                              \
STB__nogcc( typedef struct stb__st_##TYPE TYPE;  )                            \
struct stb__st_##TYPE {                                                       \
   FIELDS                                                                     \
   STB_(N,_hashpair) *table;                                                  \
   unsigned int mask;                                                         \
   int count, limit;                                                          \
   int deleted;                                                               \
                                                                              \
   int delete_threshhold;                                                     \
   int grow_threshhold;                                                       \
   int shrink_threshhold;                                                     \
   unsigned char alloced, has_empty, has_del;                                 \
   VALUE ev; VALUE dv;                                                        \
};                                                                            \
                                                                              \
static unsigned int STB_(N, hash)(KEY k)                                      \
{                                                                             \
   HASH                                                                       \
}                                                                             \
                                                                              \
PREFIX int STB__(N, init)(TYPE *h, int count)                                        \
{                                                                             \
   int i;                                                                     \
   if (count < 4) count = 4;                                                  \
   h->limit = count;                                                          \
   h->count = 0;                                                              \
   h->mask  = count-1;                                                        \
   h->deleted = 0;                                                            \
   h->grow_threshhold = (int) (count * LOAD_FACTOR);                          \
   h->has_empty = h->has_del = 0;                                             \
   h->alloced = 0;                                                            \
   if (count <= 64)                                                           \
      h->shrink_threshhold = 0;                                               \
   else                                                                       \
      h->shrink_threshhold = (int) (count * (LOAD_FACTOR/2.25));              \
   h->delete_threshhold = (int) (count * (1-LOAD_FACTOR)/2);                  \
   h->table = (STB_(N,_hashpair)*) malloc(sizeof(h->table[0]) * count);       \
   if (h->table == NULL) return 0;                                            \
   /* ideally this gets turned into a memset32 automatically */               \
   for (i=0; i < count; ++i)                                                  \
      h->table[i].k = EMPTY;                                                  \
   return 1;                                                                  \
}                                                                             \
                                                                              \
PREFIX int STB__(N, memory_usage)(TYPE *h)                                           \
{                                                                             \
   return sizeof(*h) + h->limit * sizeof(h->table[0]);                        \
}                                                                             \
                                                                              \
PREFIX TYPE * STB__(N, create)(void)                                                 \
{                                                                             \
   TYPE *h = (TYPE *) malloc(sizeof(*h));                                     \
   if (h) {                                                                   \
      if (STB__(N, init)(h, 16))                                              \
         h->alloced = 1;                                                      \
      else { free(h); h=NULL; }                                               \
   }                                                                          \
   return h;                                                                  \
}                                                                             \
                                                                              \
PREFIX void STB__(N, destroy)(TYPE *a)                                               \
{                                                                             \
   int i;                                                                     \
   for (i=0; i < a->limit; ++i)                                               \
      if (!CCOMPARE(a->table[i].k,EMPTY) && !CCOMPARE(a->table[i].k, DEL))    \
         DISPOSE(a->table[i].k);                                              \
   free(a->table);                                                            \
   if (a->alloced)                                                            \
      free(a);                                                                \
}                                                                             \
                                                                              \
static void STB_(N, rehash)(TYPE *a, int count);                              \
                                                                              \
PREFIX int STB__(N,get_flag)(TYPE *a, KEY k, VALUE *v)                               \
{                                                                             \
   unsigned int h = STB_(N, hash)(k);                                         \
   unsigned int n = h & a->mask, s;                                           \
   if (CCOMPARE(k,EMPTY)){ if (a->has_empty) *v = a->ev; return a->has_empty;}\
   if (CCOMPARE(k,DEL)) { if (a->has_del  ) *v = a->dv; return a->has_del;   }\
   if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                               \
   SAFE(if (!CCOMPARE(a->table[n].k,DEL)))                                    \
   if (VCOMPARE(a->table[n].k,k)) { *v = a->table[n].v; return 1; }            \
   s = stb_rehash(h) | 1;                                                     \
   for(;;) {                                                                  \
      n = (n + s) & a->mask;                                                  \
      if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                            \
      SAFE(if (CCOMPARE(a->table[n].k,DEL)) continue;)                        \
      if (VCOMPARE(a->table[n].k,k))                                           \
         { *v = a->table[n].v; return 1; }                                    \
   }                                                                          \
}                                                                             \
                                                                              \
HASVNULL(                                                                     \
   PREFIX VALUE STB__(N,get)(TYPE *a, KEY k)                                         \
   {                                                                          \
      VALUE v;                                                                \
      if (STB__(N,get_flag)(a,k,&v)) return v;                                \
      else                           return VNULL;                            \
   }                                                                          \
)                                                                             \
                                                                              \
PREFIX int STB__(N,getkey)(TYPE *a, KEY k, KEY *kout)                                \
{                                                                             \
   unsigned int h = STB_(N, hash)(k);                                         \
   unsigned int n = h & a->mask, s;                                           \
   if (CCOMPARE(k,EMPTY)||CCOMPARE(k,DEL)) return 0;                          \
   if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                               \
   SAFE(if (!CCOMPARE(a->table[n].k,DEL)))                                    \
   if (VCOMPARE(a->table[n].k,k)) { *kout = a->table[n].k; return 1; }         \
   s = stb_rehash(h) | 1;                                                     \
   for(;;) {                                                                  \
      n = (n + s) & a->mask;                                                  \
      if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                            \
      SAFE(if (CCOMPARE(a->table[n].k,DEL)) continue;)                        \
      if (VCOMPARE(a->table[n].k,k))                                          \
         { *kout = a->table[n].k; return 1; }                                 \
   }                                                                          \
}                                                                             \
                                                                              \
static int STB_(N,addset)(TYPE *a, KEY k, VALUE v,                            \
                             int allow_new, int allow_old, int copy)          \
{                                                                             \
   unsigned int h = STB_(N, hash)(k);                                         \
   unsigned int n = h & a->mask;                                              \
   int b = -1;                                                                \
   if (CCOMPARE(k,EMPTY)) {                                                   \
      if (a->has_empty ? allow_old : allow_new) {                             \
          n=a->has_empty; a->ev = v; a->has_empty = 1; return !n;             \
      } else return 0;                                                        \
   }                                                                          \
   if (CCOMPARE(k,DEL)) {                                                     \
      if (a->has_del ? allow_old : allow_new) {                               \
          n=a->has_del; a->dv = v; a->has_del = 1; return !n;                 \
      } else return 0;                                                        \
   }                                                                          \
   if (!CCOMPARE(a->table[n].k, EMPTY)) {                                     \
      unsigned int s;                                                         \
      if (CCOMPARE(a->table[n].k, DEL))                                       \
         b = n;                                                               \
      else if (VCOMPARE(a->table[n].k,k)) {                                   \
         if (allow_old)                                                       \
            a->table[n].v = v;                                                \
         return !allow_new;                                                   \
      }                                                                       \
      s = stb_rehash(h) | 1;                                                  \
      for(;;) {                                                               \
         n = (n + s) & a->mask;                                               \
         if (CCOMPARE(a->table[n].k, EMPTY)) break;                           \
         if (CCOMPARE(a->table[n].k, DEL)) {                                  \
            if (b < 0) b = n;                                                 \
         } else if (VCOMPARE(a->table[n].k,k)) {                              \
            if (allow_old)                                                    \
               a->table[n].v = v;                                             \
            return !allow_new;                                                \
         }                                                                    \
      }                                                                       \
   }                                                                          \
   if (!allow_new) return 0;                                                  \
   if (b < 0) b = n; else --a->deleted;                                       \
   a->table[b].k = copy ? COPY(k) : k;                                        \
   a->table[b].v = v;                                                         \
   ++a->count;                                                                \
   if (a->count > a->grow_threshhold)                                         \
      STB_(N,rehash)(a, a->limit*2);                                          \
   return 1;                                                                  \
}                                                                             \
                                                                              \
PREFIX int STB__(N, set)(TYPE *a, KEY k, VALUE v){return STB_(N,addset)(a,k,v,1,1,1);}\
PREFIX int STB__(N, add)(TYPE *a, KEY k, VALUE v){return STB_(N,addset)(a,k,v,1,0,1);}\
PREFIX int STB__(N, update)(TYPE*a,KEY k,VALUE v){return STB_(N,addset)(a,k,v,0,1,1);}\
                                                                              \
PREFIX int STB__(N, remove)(TYPE *a, KEY k, VALUE *v)                                \
{                                                                             \
   unsigned int h = STB_(N, hash)(k);                                         \
   unsigned int n = h & a->mask, s;                                           \
   if (CCOMPARE(k,EMPTY)) { if (a->has_empty) { if(v)*v = a->ev; a->has_empty=0; return 1; } return 0; } \
   if (CCOMPARE(k,DEL))   { if (a->has_del  ) { if(v)*v = a->dv; a->has_del  =0; return 1; } return 0; } \
   if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                               \
   if (SAFE(CCOMPARE(a->table[n].k,DEL) || ) !VCOMPARE(a->table[n].k,k)) {     \
      s = stb_rehash(h) | 1;                                                  \
      for(;;) {                                                               \
         n = (n + s) & a->mask;                                               \
         if (CCOMPARE(a->table[n].k,EMPTY)) return 0;                         \
         SAFE(if (CCOMPARE(a->table[n].k, DEL)) continue;)                    \
         if (VCOMPARE(a->table[n].k,k)) break;                                 \
      }                                                                       \
   }                                                                          \
   DISPOSE(a->table[n].k);                                                    \
   a->table[n].k = DEL;                                                       \
   --a->count;                                                                \
   ++a->deleted;                                                              \
   if (v != NULL)                                                             \
      *v = a->table[n].v;                                                     \
   if (a->count < a->shrink_threshhold)                                       \
      STB_(N, rehash)(a, a->limit >> 1);                                      \
   else if (a->deleted > a->delete_threshhold)                                \
      STB_(N, rehash)(a, a->limit);                                           \
   return 1;                                                                  \
}                                                                             \
                                                                              \
PREFIX TYPE * STB__(NC, copy)(TYPE *a)                                        \
{                                                                             \
   int i;                                                                     \
   TYPE *h = (TYPE *) malloc(sizeof(*h));                                     \
   if (!h) return NULL;                                                       \
   if (!STB__(N, init)(h, a->limit)) { free(h); return NULL; }                \
   h->count = a->count;                                                       \
   h->deleted = a->deleted;                                                   \
   h->alloced = 1;                                                            \
   h->ev = a->ev; h->dv = a->dv;                                              \
   h->has_empty = a->has_empty; h->has_del = a->has_del;                      \
   memcpy(h->table, a->table, h->limit * sizeof(h->table[0]));                \
   for (i=0; i < a->limit; ++i)                                               \
      if (!CCOMPARE(h->table[i].k,EMPTY) && !CCOMPARE(h->table[i].k,DEL))     \
         h->table[i].k = COPY(h->table[i].k);                                 \
   return h;                                                                  \
}                                                                             \
                                                                              \
static void STB_(N, rehash)(TYPE *a, int count)                               \
{                                                                             \
   int i;                                                                     \
   TYPE b;                                                                    \
   STB__(N, init)(&b, count);                                                 \
   for (i=0; i < a->limit; ++i)                                               \
      if (!CCOMPARE(a->table[i].k,EMPTY) && !CCOMPARE(a->table[i].k,DEL))     \
         STB_(N,addset)(&b, a->table[i].k, a->table[i].v,1,1,0);              \
   free(a->table);                                                            \
   a->table = b.table;                                                        \
   a->mask = b.mask;                                                          \
   a->count = b.count;                                                        \
   a->limit = b.limit;                                                        \
   a->deleted = b.deleted;                                                    \
   a->delete_threshhold = b.delete_threshhold;                                \
   a->grow_threshhold = b.grow_threshhold;                                    \
   a->shrink_threshhold = b.shrink_threshhold;                                \
}

#define STB_equal(a,b)  ((a) == (b))

#define stb_define_hash(TYPE,N,KEY,EMPTY,DEL,HASH,VALUE)                      \
   stb_define_hash_base(STB_noprefix, TYPE,STB_nofields,N,NC,0.85f,           \
              KEY,EMPTY,DEL,STB_nocopy,STB_nodelete,STB_nosafe,               \
              STB_equal,STB_equal,HASH,                                       \
              VALUE,STB_nonullvalue,0)

#define stb_define_hash_vnull(TYPE,N,KEY,EMPTY,DEL,HASH,VALUE,VNULL)          \
   stb_define_hash_base(STB_noprefix, TYPE,STB_nofields,N,NC,0.85f,           \
              KEY,EMPTY,DEL,STB_nocopy,STB_nodelete,STB_nosafe,               \
              STB_equal,STB_equal,HASH,                                       \
              VALUE,STB_nullvalue,VNULL)

//////////////////////////////////////////////////////////////////////////////
//
//                        stb_ptrmap
//
// An stb_ptrmap data structure is an O(1) hash table between pointers. One
// application is to let you store "extra" data associated with pointers,
// which is why it was originally called stb_extra.

stb_declare_hash(STB_EXTERN, stb_ptrmap, stb_ptrmap_, void *, void *)
stb_declare_hash(STB_EXTERN, stb_idict, stb_idict_, stb_int32, stb_int32)
stb_declare_hash(STB_EXTERN, stb_uidict, stbi_uidict_, stb_uint32, stb_uint32)

STB_EXTERN void        stb_ptrmap_delete(stb_ptrmap *e, void (*free_func)(void *));
STB_EXTERN stb_ptrmap *stb_ptrmap_new(void);

STB_EXTERN stb_idict * stb_idict_new_size(int size);
STB_EXTERN void        stb_idict_remove_all(stb_idict *e);
STB_EXTERN void        stb_uidict_reset(stb_uidict *e);

#ifdef STB_DEFINE

#define STB_EMPTY ((void *) 2)
#define STB_EDEL  ((void *) 6)

stb_define_hash_base(STB_noprefix,stb_ptrmap, STB_nofields, stb_ptrmap_,stb_ptrmap_,0.85f,
              void *,STB_EMPTY,STB_EDEL,STB_nocopy,STB_nodelete,STB_nosafe,
              STB_equal,STB_equal,return stb_hashptr(k);,
              void *,STB_nullvalue,NULL)

stb_ptrmap *stb_ptrmap_new(void)
{
   return stb_ptrmap_create();
}

void stb_ptrmap_delete(stb_ptrmap *e, void (*free_func)(void *))
{
   int i;
   if (free_func)
      for (i=0; i < e->limit; ++i)
         if (e->table[i].k != STB_EMPTY && e->table[i].k != STB_EDEL) {
            if (free_func == free)
               free(e->table[i].v); // allow STB_MALLOC_WRAPPER to operate
            else
               free_func(e->table[i].v);
         }
   stb_ptrmap_destroy(e);
}

// extra fields needed for stua_dict
#define STB_IEMPTY  ((int) 1)
#define STB_IDEL    ((int) 3)
stb_define_hash_base(STB_noprefix, stb_idict, short type; short gc; STB_nofields, stb_idict_,stb_idict_,0.95f,
              stb_int32,STB_IEMPTY,STB_IDEL,STB_nocopy,STB_nodelete,STB_nosafe,
              STB_equal,STB_equal,
              return stb_rehash_improved(k);,stb_int32,STB_nonullvalue,0)

stb_idict * stb_idict_new_size(int size)
{
   stb_idict *e = (stb_idict *) malloc(sizeof(*e));
   if (e) {
      if (!stb_is_pow2(size))
         size = 1 << stb_log2_ceil(size);
      stb_idict_init(e, size);
      e->alloced = 1;
   }
   return e;
}

void stb_idict_remove_all(stb_idict *e)
{
   int n;
   for (n=0; n < e->limit; ++n)
      e->table[n].k = STB_IEMPTY;
   e->has_empty = e->has_del = 0;
   e->count = 0;
   e->deleted = 0;
}

stb_define_hash_base(STB_noprefix, stb_uidict, STB_nofields, stb_uidict_,stb_uidict_,0.85f,
              stb_int32,0xffffffff,0xfffffffe,STB_nocopy,STB_nodelete,STB_nosafe,
              STB_equal,STB_equal,
              return stb_rehash_improved(k);,stb_uint32,STB_nonullvalue,0)

void stb_uidict_reset(stb_uidict *e)
{
   int n;
   for (n=0; n < e->limit; ++n)
      e->table[n].k = 0xffffffff;
   e->has_empty = e->has_del = 0;
   e->count = 0;
   e->deleted = 0;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                        stb_sparse_ptr_matrix
//
// An stb_ptrmap data structure is an O(1) hash table storing an arbitrary
// block of data for a given pair of pointers.
//
// If create=0, returns

typedef struct stb__st_stb_spmatrix stb_spmatrix;

STB_EXTERN stb_spmatrix * stb_sparse_ptr_matrix_new(int val_size);
STB_EXTERN void           stb_sparse_ptr_matrix_free(stb_spmatrix *z);
STB_EXTERN void         * stb_sparse_ptr_matrix_get(stb_spmatrix *z, void *a, void *b, int create);

#ifdef STB_DEFINE
typedef struct
{
   void *a;
   void *b;
} stb__ptrpair;

static stb__ptrpair stb__ptrpair_empty = { (void *) 1, (void *) 1 };
static stb__ptrpair stb__ptrpair_del   = { (void *) 2, (void *) 2 };

#define STB__equal_ptrpair(x,y) ((x).a == (y).a && (x).b == (y).b)

stb_define_hash_base(STB_noprefix, stb_spmatrix, int val_size; void *arena;, stb__spmatrix_,stb__spmatrix_, 0.85,
     stb__ptrpair, stb__ptrpair_empty, stb__ptrpair_del,
     STB_nocopy, STB_nodelete, STB_nosafe,
     STB__equal_ptrpair, STB__equal_ptrpair, return stb_rehash(stb_hashptr(k.a))+stb_hashptr(k.b);,
     void *, STB_nullvalue, 0)

stb_spmatrix *stb_sparse_ptr_matrix_new(int val_size)
{
   stb_spmatrix *m = stb__spmatrix_create();
   if (m) m->val_size = val_size;
   if (m) m->arena = stb_malloc_global(1);
   return m;
}

void stb_sparse_ptr_matrix_free(stb_spmatrix *z)
{
   if (z->arena) stb_free(z->arena);
   stb__spmatrix_destroy(z);
}

void *stb_sparse_ptr_matrix_get(stb_spmatrix *z, void *a, void *b, int create)
{
   stb__ptrpair t = { a,b };
   void *data = stb__spmatrix_get(z, t);
   if (!data && create) {
      data = stb_malloc_raw(z->arena, z->val_size);
      if (!data) return NULL;
      memset(data, 0, z->val_size);
      stb__spmatrix_add(z, t, data);
   }
   return data;
}
#endif



//////////////////////////////////////////////////////////////////////////////
//
//                  SDICT: Hash Table for Strings (symbol table)
//
//           if "use_arena=1", then strings will be copied
//           into blocks and never freed until the sdict is freed;
//           otherwise they're malloc()ed and free()d on the fly.
//           (specify use_arena=1 if you never stb_sdict_remove)

stb_declare_hash(STB_EXTERN, stb_sdict, stb_sdict_, char *, void *)

STB_EXTERN stb_sdict * stb_sdict_new(int use_arena);
STB_EXTERN stb_sdict * stb_sdict_copy(stb_sdict*);
STB_EXTERN void        stb_sdict_delete(stb_sdict *);
STB_EXTERN void *      stb_sdict_change(stb_sdict *, char *str, void *p);
STB_EXTERN int         stb_sdict_count(stb_sdict *d);

STB_EXTERN int         stb_sdict_internal_limit(stb_sdict *d);
STB_EXTERN char *      stb_sdict_internal_key(stb_sdict *d, int n);
STB_EXTERN void *      stb_sdict_internal_value(stb_sdict *d, int n);

#define stb_sdict_for(d,i,q,z)                                          \
   for(i=0; i < stb_sdict_internal_limit(d) ? (q=stb_sdict_internal_key(d,i),z=stb_sdict_internal_value(d,i),1) : 0; ++i)    \
      if (q==NULL||q==(void *) 1);else   // reversed makes macro friendly

#ifdef STB_DEFINE

// if in same translation unit, for speed, don't call accessors
#undef stb_sdict_for
#define stb_sdict_for(d,i,q,z)                                          \
   for(i=0; i < (d)->limit ? (q=(d)->table[i].k,z=(d)->table[i].v,1) : 0; ++i)    \
      if (q==NULL||q==(void *) 1);else   // reversed makes macro friendly

#define STB_DEL ((void *) 1)
#define STB_SDEL  ((char *) 1)

#define stb_sdict__copy(x)                                             \
   stb_p_strcpy_s(a->arena ? stb_malloc_string(a->arena, strlen(x)+1)    \
                         : (char *) malloc(strlen(x)+1), strlen(x)+1, x)

#define stb_sdict__dispose(x)  if (!a->arena) free(x)

stb_define_hash_base(STB_noprefix, stb_sdict, void*arena;, stb_sdict_,stb_sdictinternal_, 0.85f,
        char *, NULL, STB_SDEL, stb_sdict__copy, stb_sdict__dispose,
                        STB_safecompare, !strcmp, STB_equal, return stb_hash(k);,
        void *, STB_nullvalue, NULL)

int stb_sdict_count(stb_sdict *a)
{
   return a->count;
}

int stb_sdict_internal_limit(stb_sdict *a)
{
   return a->limit;
}
char* stb_sdict_internal_key(stb_sdict *a, int n)
{
   return a->table[n].k;
}
void* stb_sdict_internal_value(stb_sdict *a, int n)
{
   return a->table[n].v;
}

stb_sdict * stb_sdict_new(int use_arena)
{
   stb_sdict *d = stb_sdict_create();
   if (d == NULL) return NULL;
   d->arena = use_arena ? stb_malloc_global(1) : NULL;
   return d;
}

stb_sdict* stb_sdict_copy(stb_sdict *old)
{
   stb_sdict *n;
   void *old_arena = old->arena;
   void *new_arena = old_arena ? stb_malloc_global(1) : NULL;
   old->arena = new_arena;
   n = stb_sdictinternal_copy(old);
   old->arena = old_arena;
   if (n)
      n->arena = new_arena;
   else if (new_arena)
      stb_free(new_arena);
   return n;
}


void stb_sdict_delete(stb_sdict *d)
{
   if (d->arena)
      stb_free(d->arena);
   stb_sdict_destroy(d);
}

void * stb_sdict_change(stb_sdict *d, char *str, void *p)
{
   void *q = stb_sdict_get(d, str);
   stb_sdict_set(d, str, p);
   return q;
}
#endif

//////////////////////////////////////////////////////////////////////////////
//
//                     Instantiated data structures
//
// This is an attempt to implement a templated data structure.
// What you do is define a struct foo, and then include several
// pointer fields to struct foo in your struct. Then you call
// the instantiator, which creates the functions that implement
// the data structure. This requires massive undebuggable #defines,
// so we limit the cases where we do this.
//
// AA tree is an encoding of a 2-3 tree whereas RB trees encode a 2-3-4 tree;
// much simpler code due to fewer cases.

#define stb__bst_parent(x)    x
#define stb__bst_noparent(x)

#define stb_bst_fields(N)                                   \
    *STB_(N,left), *STB_(N,right);                          \
    unsigned char STB_(N,level)

#define stb_bst_fields_parent(N)                            \
    *STB_(N,left), *STB_(N,right),  *STB_(N,parent);        \
    unsigned char STB_(N,level)

#define STB__level(N,x)         ((x) ? (x)->STB_(N,level) : 0)

#define stb_bst_base(TYPE, N, TREE, M, compare, PAR)                         \
                                                                             \
static int STB_(N,_compare)(TYPE *p, TYPE *q)                                \
{                                                                            \
   compare                                                    
Download .txt
gitextract_kez3kfrp/

├── .NO_AI/
│   └── README.md
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── 1-stb_image-doesn-t-load-specific-image-correctly.md
│   │   ├── 2-bug_report.md
│   │   ├── 3-feature_request.md
│   │   └── config.yml
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       └── ci-fuzz.yml
├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── data/
│   └── herringbone/
│       └── license.txt
├── deprecated/
│   ├── rrsprintf.h
│   ├── stb.h
│   ├── stb_image.c
│   ├── stb_image_resize.h
│   ├── stretch_test.c
│   ├── stretchy_buffer.h
│   └── stretchy_buffer.txt
├── docs/
│   ├── other_libs.md
│   ├── stb_howto.txt
│   ├── stb_voxel_render_interview.md
│   └── why_public_domain.md
├── stb_c_lexer.h
├── stb_connected_components.h
├── stb_divide.h
├── stb_ds.h
├── stb_dxt.h
├── stb_easy_font.h
├── stb_herringbone_wang_tile.h
├── stb_hexwave.h
├── stb_image.h
├── stb_image_resize2.h
├── stb_image_resize_test/
│   ├── dotimings.c
│   ├── old_image_resize.h
│   ├── oldir.c
│   ├── stbirtest.c
│   └── vf_train.c
├── stb_image_write.h
├── stb_include.h
├── stb_leakcheck.h
├── stb_perlin.h
├── stb_rect_pack.h
├── stb_sprintf.h
├── stb_textedit.h
├── stb_tilemap_editor.h
├── stb_truetype.h
├── stb_vorbis.c
├── stb_voxel_render.h
├── tests/
│   ├── Makefile
│   ├── c_lexer_test.c
│   ├── c_lexer_test.dsp
│   ├── caveview/
│   │   ├── README.md
│   │   ├── cave_main.c
│   │   ├── cave_mesher.c
│   │   ├── cave_parse.c
│   │   ├── cave_parse.h
│   │   ├── cave_render.c
│   │   ├── caveview.dsp
│   │   ├── caveview.dsw
│   │   ├── caveview.h
│   │   ├── glext.h
│   │   ├── glext_list.h
│   │   ├── main.c
│   │   ├── stb_gl.h
│   │   ├── stb_glprog.h
│   │   └── win32/
│   │       └── SDL_windows_main.c
│   ├── fuzz_main.c
│   ├── grid_reachability.c
│   ├── herringbone.dsp
│   ├── herringbone_generator.c
│   ├── herringbone_map.c
│   ├── herringbone_map.dsp
│   ├── image_test.c
│   ├── image_test.dsp
│   ├── image_write_test.c
│   ├── ossfuzz.sh
│   ├── oversample/
│   │   ├── README.md
│   │   ├── main.c
│   │   ├── oversample.dsp
│   │   ├── oversample.dsw
│   │   └── stb_wingraph.h
│   ├── pbm/
│   │   ├── basi0g16.pgm
│   │   ├── basi2c16.ppm
│   │   ├── cdfn2c08.ppm
│   │   ├── cdun2c08.ppm
│   │   ├── comment.pgm
│   │   └── ctfn0g04.pgm
│   ├── pg_test/
│   │   └── pg_test.c
│   ├── pngsuite/
│   │   ├── PngSuite.LICENSE
│   │   └── ref_results.csv
│   ├── prerelease/
│   │   └── stb_lib.h
│   ├── resample_test.cpp
│   ├── resample_test_c.c
│   ├── resize.dsp
│   ├── sdf/
│   │   └── sdf_test.c
│   ├── stb.c
│   ├── stb.dsp
│   ├── stb.dsw
│   ├── stb_c_lexer_fuzzer.cpp
│   ├── stb_cpp.cpp
│   ├── stb_cpp.dsp
│   ├── stb_png.dict
│   ├── stb_static.c
│   ├── stbi_read_fuzzer.c
│   ├── stblib.dsp
│   ├── stblib_test.c
│   ├── stblib_test_companion.c
│   ├── stretch_test.dsp
│   ├── test.sbm
│   ├── test_c_compilation.c
│   ├── test_c_lexer.c
│   ├── test_cpp_compilation.cpp
│   ├── test_ds.c
│   ├── test_ds_cpp.cpp
│   ├── test_dxt.c
│   ├── test_easyfont.c
│   ├── test_image.c
│   ├── test_image_write.c
│   ├── test_perlin.c
│   ├── test_png_paeth.c
│   ├── test_png_regress.c
│   ├── test_siphash.c
│   ├── test_sprintf.c
│   ├── test_truetype.c
│   ├── test_vorbis.c
│   ├── test_voxel.c
│   ├── textedit_sample.c
│   ├── tilemap_editor_integration_example.c
│   ├── truetype_test_win32.c
│   └── vorbseek/
│       ├── vorbseek.c
│       └── vorbseek.dsp
└── tools/
    ├── README.footer.md
    ├── README.header.md
    ├── README.list
    ├── build_matrix.c
    ├── easy_font_maker.c
    ├── make_readme.c
    ├── make_readme.dsp
    ├── mr.bat
    ├── trailing_whitespace.c
    ├── unicode/
    │   └── unicode.dsp
    └── unicode.c
Download .txt
Showing preview only (246K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2642 symbols across 79 files)

FILE: deprecated/rrsprintf.h
  function RRPUBLIC_DEF (line 195) | RRPUBLIC_DEF void RR_SPRINTF_DECORATE( setseparators )( char pcomma, cha...
  function RRPUBLIC_DEF (line 201) | RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintfcb )( RRSPRINTFCB * callba...
  function RRPUBLIC_DEF (line 745) | RRPUBLIC_DEF int RR_SPRINTF_DECORATE( sprintf )( char * buf, char const ...
  type RRCCS (line 752) | typedef struct RRCCS
  function RRPUBLIC_DEF (line 781) | RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsnprintf )( char * buf, int count...
  function RRPUBLIC_DEF (line 803) | RRPUBLIC_DEF int RR_SPRINTF_DECORATE( snprintf )( char * buf, int count,...
  function RRPUBLIC_DEF (line 811) | RRPUBLIC_DEF int RR_SPRINTF_DECORATE( vsprintf )( char * buf, char const...
  function rS32 (line 825) | static rS32 rrreal_to_parts( rS64 * bits, rS32 * expo, double value )
  function rrraise_to_power10 (line 887) | static void rrraise_to_power10( double *ohi, double *olo, double d, rS32...
  function rS32 (line 935) | static rS32 rrreal_to_str( char const * * start, rU32 * len, char *out, ...

FILE: deprecated/stb.h
  type Bool (line 250) | typedef int Bool;
  type uint8 (line 320) | typedef unsigned char  uint8 ;
  type int8 (line 321) | typedef   signed char   int8 ;
  type uint16 (line 322) | typedef unsigned short uint16;
  type int16 (line 323) | typedef   signed short  int16;
  type uint32 (line 325) | typedef unsigned long  uint32;
  type int32 (line 326) | typedef   signed long   int32;
  type uint32 (line 328) | typedef unsigned int   uint32;
  type int32 (line 329) | typedef   signed int    int32;
  type uchar (line 332) | typedef unsigned char  uchar ;
  type ushort (line 333) | typedef unsigned short ushort;
  type uint (line 334) | typedef unsigned int   uint  ;
  type ulong (line 335) | typedef unsigned long  ulong ;
  type stb_uchar (line 349) | typedef unsigned char stb_uchar;
  type stb_uint8 (line 350) | typedef unsigned char stb_uint8;
  type stb_uint (line 351) | typedef unsigned int  stb_uint;
  type stb_uint16 (line 352) | typedef unsigned short stb_uint16;
  type stb_int16 (line 353) | typedef          short stb_int16;
  type stb_int8 (line 354) | typedef   signed char  stb_int8;
  type stb_uint32 (line 356) | typedef unsigned long  stb_uint32;
  type stb_int32 (line 357) | typedef          long  stb_int32;
  type stb_uint32 (line 359) | typedef unsigned int   stb_uint32;
  type stb_int32 (line 360) | typedef          int   stb_int32;
  type stb_uint64 (line 366) | typedef unsigned __int64 stb_uint64;
  type __int64 (line 367) | typedef          __int64 stb_int64;
  type stb_uint64 (line 372) | typedef unsigned long long stb_uint64;
  type stb_int64 (line 373) | typedef          long long stb_int64;
  type stb_uint64 (line 387) | typedef stb_uint64 stb_uinta;
  type stb_int64 (line 388) | typedef stb_int64  stb_inta;
  type stb_uint32 (line 391) | typedef stb_uint32 stb_uinta;
  type stb_int32 (line 392) | typedef stb_int32  stb_inta;
  type stb_uintptr (line 399) | typedef union
  function FILE (line 431) | static FILE * stb_p_fopen(const char *filename, const char *mode)
  function FILE (line 439) | static FILE * stb_p_wfopen(const wchar_t *filename, const wchar_t *mode)
  function stb_mcheck (line 569) | int stb_mcheck(void *p)
  function stb__check2 (line 586) | static void stb__check2(void *p, size_t sz, char *file, int line)
  function stb_malloc_checkall (line 591) | void stb_malloc_checkall(void)
  function stb_malloc_checkall (line 596) | void stb_malloc_checkall(void) { }
  function stb_malloc_check_counter (line 600) | void stb_malloc_check_counter(int init_delay, int rep_delay)
  function stb_mcheck_all (line 606) | void stb_mcheck_all(void)
  function stb__free_final (line 638) | static void stb__free_final(void *p)
  function stb__free (line 661) | void stb__free(void *p, char *file, int line)
  function stb_vsnprintf (line 805) | int stb_vsnprintf(char *s, size_t n, const char *fmt, va_list v)
  function stb_snprintf (line 822) | int stb_snprintf(char *s, size_t n, const char *fmt, ...)
  function stb__print_one (line 860) | static void stb__print_one(void *handle, char *s, ptrdiff_t  len)
  function stb__print (line 869) | static void stb__print(char *s)
  function stbprint (line 942) | void stbprint(const char *fmt, ...)
  function stbprint (line 968) | void stbprint(const char *fmt, ...)
  type stb__wchar (line 999) | typedef unsigned short stb__wchar;
  function stb__wchar (line 1010) | stb__wchar * stb_from_utf8(stb__wchar *buffer, const char *ostr, int n)
  function stb__wchar (line 1096) | stb__wchar *stb__from_utf8(const char *str)
  function stb__wchar (line 1102) | stb__wchar *stb__from_utf8_alt(const char *str)
  function stb__record_fileline (line 1143) | int  stb__record_fileline(const char *f, int n)
  function stb_fatal (line 1150) | void stb_fatal(const char *s, ...)
  function stb_log (line 1176) | void stb_log(int active)
  function stb_log_fileline (line 1181) | void stb_log_fileline(int active)
  function stb_log_name (line 1192) | void stb_log_name(char *s)
  function stb_ (line 1197) | void stb_(char *s, ...)
  function stb_append_to_file (line 1214) | void stb_append_to_file(char *filename, char *s, ...)
  type stb__4 (line 1228) | typedef struct { char d[4]; } stb__4;
  type stb__8 (line 1229) | typedef struct { char d[8]; } stb__8;
  function stb_swap (line 1232) | void stb_swap(void *p, void *q, size_t sz)
  function stb_pointer_array_free (line 1267) | void stb_pointer_array_free(void *q, int len)
  function stb_tempfree (line 1322) | void   stb_tempfree(void *b, void *p)
  function stb_smoothstep (line 1356) | float stb_smoothstep(float t)
  function stb_cubic_bezier_1d (line 1361) | float stb_cubic_bezier_1d(float t, float p0, float p1, float p2, float p3)
  function stb_newell_normal (line 1367) | void stb_newell_normal(float *normal, int num_vert, float **vert, int no...
  function stb_box_face_vertex_axis_side (line 1388) | int stb_box_face_vertex_axis_side(int face_number, int vertex_number, in...
  function stb_linear_controller (line 1405) | void stb_linear_controller(float *curpos, float target_pos, float acc, f...
  function stb_quadratic_controller (line 1433) | float stb_quadratic_controller(float target_pos, float curpos, float max...
  function stb_float_eq (line 1438) | int stb_float_eq(float x, float y, float delta, int max_ulps)
  function stb_is_prime (line 1445) | int stb_is_prime(unsigned int m)
  function stb_power_of_two_nearest_prime (line 1459) | unsigned int stb_power_of_two_nearest_prime(int n)
  function stb_linear_remap (line 1474) | double stb_linear_remap(double x, double x_min, double x_max,
  function stb_bitcount (line 1507) | int stb_bitcount(unsigned int a)
  function stb_bitreverse8 (line 1517) | unsigned int stb_bitreverse8(unsigned char n)
  function stb_bitreverse (line 1524) | unsigned int stb_bitreverse(unsigned int n)
  function stb_is_pow2 (line 1533) | int stb_is_pow2(size_t n)
  function stb_log2_floor (line 1543) | int stb_log2_floor(size_t n)
  function PREFIX (line 3985) | PREFIX int STB__(N, memory_usage)(TYPE *h)                              ...
  function PREFIX (line 3990) | PREFIX TYPE * STB__(N, create)(void)                                    ...
  function PREFIX (line 4001) | PREFIX void STB__(N, destroy)(TYPE *a)                                  ...
  function PREFIX (line 4014) | PREFIX int STB__(N,get_flag)(TYPE *a, KEY k, VALUE *v)                  ...
  function PREFIX (line 4042) | PREFIX int STB__(N,getkey)(TYPE *a, KEY k, KEY *kout)                   ...
  function PREFIX (line 4108) | PREFIX int STB__(N, set)(TYPE *a, KEY k, VALUE v){return STB_(N,addset)(...
  function PREFIX (line 4109) | PREFIX int STB__(N, add)(TYPE *a, KEY k, VALUE v){return STB_(N,addset)(...
  function PREFIX (line 4110) | PREFIX int STB__(N, update)(TYPE*a,KEY k,VALUE v){return STB_(N,addset)(...
  function PREFIX (line 4112) | PREFIX int STB__(N, remove)(TYPE *a, KEY k, VALUE *v)                   ...
  function PREFIX (line 4141) | PREFIX TYPE * STB__(NC, copy)(TYPE *a)                                  ...
  function stb_ptrmap (line 4221) | stb_ptrmap *stb_ptrmap_new(void)
  function stb_ptrmap_delete (line 4226) | void stb_ptrmap_delete(stb_ptrmap *e, void (*free_func)(void *))
  function stb_idict (line 4248) | stb_idict * stb_idict_new_size(int size)
  function stb_idict_remove_all (line 4260) | void stb_idict_remove_all(stb_idict *e)
  function stb_uidict_reset (line 4275) | void stb_uidict_reset(stb_uidict *e)
  type stb_spmatrix (line 4295) | typedef struct stb__st_stb_spmatrix stb_spmatrix;
  type stb__ptrpair (line 4302) | typedef struct
  function stb_spmatrix (line 4319) | stb_spmatrix *stb_sparse_ptr_matrix_new(int val_size)
  function stb_sparse_ptr_matrix_free (line 4327) | void stb_sparse_ptr_matrix_free(stb_spmatrix *z)
  function stb_sdict_count (line 4396) | int stb_sdict_count(stb_sdict *a)
  function stb_sdict_internal_limit (line 4401) | int stb_sdict_internal_limit(stb_sdict *a)
  function stb_sdict (line 4414) | stb_sdict * stb_sdict_new(int use_arena)
  function stb_sdict (line 4422) | stb_sdict* stb_sdict_copy(stb_sdict *old)
  function stb_sdict_delete (line 4438) | void stb_sdict_delete(stb_sdict *d)
  function TYPE (line 4603) | TYPE *STB__(N,last)(TYPE *tree)                                         ...
  function TYPE (line 4610) | TYPE *STB__(N,first)(TYPE *tree)                                        ...
  function TYPE (line 4617) | TYPE *STB__(N,next)(TYPE *tree, TYPE *item)                             ...
  function TYPE (line 4641) | TYPE *STB__(N,prev)(TYPE *tree, TYPE *item)                             ...
  type TREE (line 4684) | typedef struct                                                          ...
  function TYPE (line 4693) | TYPE *STB__(M,Next)(TREE *tree, TYPE *item)                             ...
  function TYPE (line 4695) | TYPE *STB__(M,Prev)(TREE *tree, TYPE *item)                             ...
  function TYPE (line 4697) | TYPE *STB__(M,First)(TREE *tree) { return STB__(N,first)(tree->root); }
  function TYPE (line 4698) | TYPE *STB__(M,Last) (TREE *tree) { return STB__(N,last) (tree->root); }
  type stb__nptr (line 4779) | typedef struct stb__st_nptr
  type stb__nptr_target (line 4787) | typedef struct stb__st_nptr_target
  type stb__memory_leaf (line 4794) | typedef struct
  type stb__memory_node (line 4800) | typedef struct
  function stb__memory_leaf (line 4807) | static stb__memory_leaf *stb__nptr_find_leaf(void *mem)
  function stb__nptr_free (line 4822) | static void stb__nptr_free(void *p)
  function stb__memory_leaf (line 4827) | static stb__memory_leaf *stb__nptr_make_leaf(void *mem)
  function stb__nptr_target (line 4846) | static stb__nptr_target *stb__nptr_find_target(void *target, int force)
  function stb__nptr (line 4869) | static stb__nptr *stb__nptr_find_pointer(void *ptr, int force)
  function stb_nptr_set (line 4893) | void stb_nptr_set(void *address_of_pointer, void *value_to_write)
  function stb_nptr_didset (line 4901) | void stb_nptr_didset(void *address_of_pointer)
  function stb__nptr_block (line 4924) | void stb__nptr_block(void *address, int len, void (*function)(stb__memor...
  function stb__nptr_delete_pointers (line 5000) | static void stb__nptr_delete_pointers(stb__memory_leaf *f, int offset, v...
  function stb__nptr_delete_targets (line 5018) | static void stb__nptr_delete_targets(stb__memory_leaf *f, int offset, vo...
  function stb_nptr_didfree (line 5041) | void stb_nptr_didfree(void *address_being_freed, int len)
  function stb_nptr_free (line 5049) | void stb_nptr_free(void *address_being_freed, int len)
  function stb__nptr_move_targets (line 5055) | static void stb__nptr_move_targets(stb__memory_leaf *f, int offset, void...
  function stb__nptr_move_pointers (line 5082) | static void stb__nptr_move_pointers(stb__memory_leaf *f, int offset, voi...
  function stb_nptr_realloc (line 5101) | void stb_nptr_realloc(void *new_address, void *old_address, int len)
  function stb_nptr_move (line 5115) | void stb_nptr_move(void *new_address, void *old_address)
  function stb_nptr_recache (line 5120) | void stb_nptr_recache(void)
  type STBF (line 5204) | typedef struct
  function STBF (line 5221) | STBF *stb_tfopen(char *filename, char *mode)
  function stb_fexists (line 5279) | int stb_fexists(char *filename)
  function time_t (line 5288) | time_t stb_ftimestamp(char *filename)
  function stb_filelen (line 5302) | size_t  stb_filelen(FILE *f)
  function stb_filewrite (line 5332) | int stb_filewrite(char *filename, void *data, size_t length)
  function stb_filewritestr (line 5353) | int stb_filewritestr(char *filename, char *data)
  function stb_fullpath (line 5485) | int stb_fullpath(char *abs, int abs_size, char *rel)
  function stb_fcmp_core (line 5510) | static int stb_fcmp_core(FILE *f, FILE *g)
  function stb_fcmp (line 5534) | int stb_fcmp(char *s1, char *s2)
  function stb_feq (line 5551) | int stb_feq(char *s1, char *s2)
  type stb__file_data (line 5574) | typedef struct
  function FILE (line 5581) | static FILE *stb__open_temp_file(char *temp_name, char *src_name, const ...
  function FILE (line 5630) | FILE *  stb_fopen(char *filename, const char *mode)
  function stb_fclose (line 5662) | int     stb_fclose(FILE *f, int keep)
  function stb_copyfile (line 5754) | int stb_copyfile(char *src, char *dest)
  function stb_size_varlen (line 5808) | int stb_size_varlen(int v) { return stb_size_varlenu(stb__varlen_xform(v...
  function stb_size_varlenu (line 5809) | int stb_size_varlenu(unsigned int v)
  function stb_fput_varlen (line 5818) | void    stb_fput_varlen(FILE *f, int v) { stb_fput_varlenu(f, stb__varle...
  function stb_fput_varlenu (line 5820) | void    stb_fput_varlenu(FILE *f, unsigned int z)
  function stb_fget_varlen (line 5831) | int     stb_fget_varlen(FILE *f)
  function stb_fget_varlenu (line 5837) | unsigned int stb_fget_varlenu(FILE *f)
  function stb_uint64 (line 5861) | stb_uint64   stb_fget_varlen64(FILE *f)
  function stb_size_varlen64 (line 5897) | int stb_size_varlen64(stb_uint64 v)
  function stb_fput_varlen64 (line 5910) | void    stb_fput_varlen64(FILE *f, stb_uint64 v)
  function stb_fput_ranged (line 5928) | void    stb_fput_ranged(FILE *f, int v, int b, stb_uint n)
  function stb_fget_ranged (line 5939) | int     stb_fget_ranged(FILE *f, int b, stb_uint n)
  function stb_size_ranged (line 5949) | int     stb_size_ranged(int b, stb_uint n)
  function stb_fput_string (line 5957) | void stb_fput_string(FILE *f, char *s)
  function stb_getopt_free (line 6025) | void   stb_getopt_free(char **opts)
  function stb_readdir_free (line 6118) | void stb_readdir_free(char **files)
  function isdotdirname (line 6127) | static int isdotdirname(char *name)
  type _wfinddata_t (line 6143) | struct _wfinddata_t
  type dirent (line 6180) | struct dirent
  function stb_delete_directory_recursive (line 6265) | void stb_delete_directory_recursive(char *dir)
  type stb_dirtree2 (line 6292) | typedef struct stb_dirtree2 stb_dirtree2;
  type stb_dirtree2 (line 6294) | struct stb_dirtree2
  function stb_dir_is_prefix (line 6314) | int stb_dir_is_prefix(char *dir, int dirlen, char *file)
  function stb_dirtree2 (line 6322) | stb_dirtree2 *stb_dirtree2_from_files_relative(char *src, char **filelis...
  function stb_dirtree2 (line 6387) | stb_dirtree2 *stb_dirtree2_from_files(char **filelist, int count)
  function stb_uint (line 6417) | stb_uint stb_crc32_block(stb_uint crc, unsigned char *buffer, stb_uint len)
  function stb_uint (line 6434) | stb_uint stb_crc32(unsigned char *buffer, stb_uint len)
  function stb_uint (line 6439) | stb_uint stb_adler32(stb_uint adler32, stb_uchar *buffer, stb_uint buflen)
  function stb__sha1 (line 6470) | static void stb__sha1(stb_uchar *chunk, stb_uint h[5])
  function stb_sha1 (line 6515) | void stb_sha1(stb_uchar output[20], stb_uchar *buffer, stb_uint len)
  function stb_sha1_file (line 6582) | int stb_sha1_file(stb_uchar output[20], char *file)
  function stb_sha1_readable (line 6650) | void stb_sha1_readable(char display[27], unsigned char sha[20])
  function stb_reg_close (line 6745) | void stb_reg_close(void *reg)
  function stb_reg_read (line 6754) | int stb_reg_read(void *zreg, const char *str, void *data, unsigned long ...
  function stb_reg_write (line 6767) | void stb_reg_write(void *zreg, const char *str, const void *data, unsign...
  function stb_reg_read_string (line 6773) | int stb_reg_read_string(void *zreg, const char *str, char *data, int len)
  function stb_reg_write_string (line 6780) | void stb_reg_write_string(void *zreg, const char *str, const char *data)
  type stb_cfg (line 6797) | typedef struct stb_cfg_st stb_cfg;
  type stb__cfg_item (line 6810) | typedef struct
  type stb_cfg_st (line 6817) | struct stb_cfg_st
  function STB_EXTERN (line 6826) | STB_EXTERN void stb_cfg_set_directory(char *dir)
  function STB_EXTERN (line 6831) | STB_EXTERN stb_cfg * stb_cfg_open(char *config, const char *mode)
  function stb_cfg_close (line 6889) | void stb_cfg_close(stb_cfg *z)
  function stb_cfg_read (line 6908) | int stb_cfg_read(stb_cfg *z, char *key, void *value, int len)
  function stb_cfg_write (line 6923) | void stb_cfg_write(stb_cfg *z, char *key, void *value, int len)
  function stb_cfg_delete (line 6941) | int stb_cfg_delete(stb_cfg *z, char *key)
  function stb_cfg_read_string (line 6952) | int stb_cfg_read_string(stb_cfg *z, char *key, char *value, int len)
  function stb_cfg_write_string (line 6959) | void stb_cfg_write_string(stb_cfg *z, char *key, char *value)
  type stb_dirtree_dir (line 6974) | typedef struct
  type stb_dirtree_file (line 6982) | typedef struct
  type stb_dirtree (line 6991) | typedef struct
  function stb__dirtree_add_dir (line 7026) | static void stb__dirtree_add_dir(char *path, time_t last, stb_dirtree *a...
  function stb__dirtree_add_file (line 7035) | static void stb__dirtree_add_file(char *name, int dir, stb_int64 size, t...
  function stb__dirtree_save_db (line 7049) | static void stb__dirtree_save_db(char *filename, stb_dirtree *data, char...
  function stb__dirtree_load_db (line 7098) | static void stb__dirtree_load_db(char *filename, stb_dirtree *data, char...
  function stb__dirtree_scandir (line 7142) | static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtr...
  function stb__dirtree_update_db (line 7240) | static int stb__dirtree_update_db(stb_dirtree *db, stb_dirtree *active)
  function stb__dirtree_free_raw (line 7320) | static void stb__dirtree_free_raw(stb_dirtree *d)
  function stb_dirtree (line 7327) | stb_dirtree *stb_dirtree_get_with_file(char *dir, char *cache_file)
  function stb_dirtree (line 7378) | stb_dirtree *stb_dirtree_get_dir(char *dir, char *cache_dir)
  function stb_dirtree (line 7404) | stb_dirtree *stb_dirtree_get(char *dir)
  function stb_dirtree_free (line 7420) | void stb_dirtree_free(stb_dirtree *d)
  function stb_dirtree_db_add_dir (line 7426) | void stb_dirtree_db_add_dir(stb_dirtree *active, char *path, time_t last)
  function stb_dirtree_db_add_file (line 7431) | void stb_dirtree_db_add_file(stb_dirtree *active, char *name, int dir, s...
  function stb_dirtree_db_read (line 7436) | void stb_dirtree_db_read(stb_dirtree *target, char *filename, char *dir)
  function stb_dirtree_db_write (line 7446) | void stb_dirtree_db_write(stb_dirtree *target, char *filename, char *dir)
  type stb_malloc_record (line 7468) | typedef struct
  function stb__hashfind (line 7487) | static int stb__hashfind(void *p)
  function stb_wrapper_allocsize (line 7503) | size_t stb_wrapper_allocsize(void *p)
  function stb__historyfind (line 7510) | static int stb__historyfind(void *p)
  function stb__grow_alloc (line 7523) | static void stb__grow_alloc(void)
  function stb__add_alloc (line 7552) | static void stb__add_alloc(void *p, size_t sz, char *file, int line)
  function stb__remove_alloc (line 7574) | static void stb__remove_alloc(int n, char *file, int line)
  function stb_wrapper_malloc (line 7585) | void stb_wrapper_malloc(void *p, size_t sz, char *file, int line)
  function stb_wrapper_free (line 7591) | void stb_wrapper_free(void *p, char *file, int line)
  function stb_wrapper_check (line 7615) | void stb_wrapper_check(void *p)
  function stb_wrapper_realloc (line 7638) | void stb_wrapper_realloc(void *p, void *q, size_t sz, char *file, int line)
  function stb_wrapper_listall (line 7669) | void stb_wrapper_listall(void (*func)(void *ptr, size_t sz, char *file, ...
  function stb_wrapper_dump (line 7678) | void stb_wrapper_dump(char *filename)
  type stb_ps (line 7741) | typedef struct stb_ps stb_ps;
  type stb_ps_bucket (line 7781) | typedef struct
  function stb_bucket_free (line 7788) | static void stb_bucket_free(stb_ps_bucket *b)
  function stb_ps_bucket (line 7793) | static stb_ps_bucket *stb_bucket_create2(void *v0, void *v1)
  function stb_ps_bucket (line 7803) | static stb_ps_bucket * stb_bucket_create3(void **v)
  type stb_ps_array (line 7815) | typedef struct
  type stb_ps_hash (line 7825) | typedef struct
  function stb_ps_hash (line 7840) | static stb_ps_hash *stb_ps_makehash(int size, int old_size, void **old_d...
  function stb_ps_delete (line 7860) | void stb_ps_delete(stb_ps *ps)
  function stb_ps (line 7870) | stb_ps *stb_ps_copy(stb_ps *ps)
  function stb_ps_find (line 7899) | int stb_ps_find(stb_ps *ps, void *value)
  function stb_ps (line 7937) | stb_ps *  stb_ps_add   (stb_ps *ps, void *value)
  function stb_ps (line 8022) | stb_ps *stb_ps_remove(stb_ps *ps, void *value)
  function stb_ps (line 8107) | stb_ps *stb_ps_remove_any(stb_ps *ps, void **value)
  function stb_ps_writelist (line 8199) | int stb_ps_writelist(stb_ps *ps, void **list, int size )
  function stb_ps_enum (line 8235) | int stb_ps_enum(stb_ps *ps, void *data, int (*func)(void *value, void *d...
  function stb_ps_count (line 8269) | int stb_ps_count (stb_ps *ps)
  function stb_ps_subset (line 8320) | int stb_ps_subset(stb_ps *bigger, stb_ps *smaller)
  function stb_ps_eq (line 8331) | int stb_ps_eq(stb_ps *p0, stb_ps *p1)
  function stb_randLCG_explicit (line 8377) | unsigned int  stb_randLCG_explicit(unsigned int seed)
  function stb_srandLCG (line 8384) | unsigned int  stb_srandLCG(unsigned int seed)
  function stb_randLCG (line 8391) | unsigned int  stb_randLCG(void)
  function stb_frandLCG (line 8398) | double stb_frandLCG(void)
  function stb_shuffle (line 8403) | void stb_shuffle(void *p, size_t n, size_t sz, unsigned int seed)
  function stb_reverse (line 8421) | void stb_reverse(void *p, size_t n, size_t sz)
  function stb_srand (line 8435) | void stb_srand(unsigned int seed)
  function stb_rand (line 8452) | unsigned int stb_rand()
  function stb_frand (line 8488) | double stb_frand(void)
  type stb_dupe (line 8534) | typedef struct stb_dupe stb_dupe;
  type stb_dupe (line 8548) | struct stb_dupe
  function stb_dupe_numsets (line 8566) | int stb_dupe_numsets(stb_dupe *sd)
  function stb_dupe_set_count (line 8578) | int stb_dupe_set_count(stb_dupe *sd, int num)
  function stb_dupe (line 8584) | stb_dupe *stb_dupe_create(stb_hash_func hash, stb_compare_func eq, int s...
  function stb_dupe_add (line 8613) | void stb_dupe_add(stb_dupe *sd, void *item)
  function stb_dupe_free (line 8621) | void stb_dupe_free(stb_dupe *sd)
  function stb__dupe_compare (line 8633) | static int stb__dupe_compare(const void *a, const void *b)
  function stb_dupe_finish (line 8641) | void stb_dupe_finish(stb_dupe *sd)
  function MODE (line 8841) | MODE FUNCNAME(TYPE *p, int n)                                           ...
  type stb_uint32 (line 8853) | typedef stb_uint32 stb_bitset;
  function stb_bitset_eq (line 8875) | int stb_bitset_eq(stb_bitset *p0, stb_bitset *p1, int len)
  function stb_bitset_disjoint (line 8883) | int stb_bitset_disjoint(stb_bitset *p0, stb_bitset *p1, int len)
  function stb_bitset_disjoint_0 (line 8891) | int stb_bitset_disjoint_0(stb_bitset *p0, stb_bitset *p1, int len)
  function stb_bitset_subset (line 8899) | int stb_bitset_subset(stb_bitset *bigger, stb_bitset *smaller, int len)
  function stb_bitset (line 8907) | stb_bitset *stb_bitset_union(stb_bitset *p0, stb_bitset *p1, int len)
  function stb_bitset_unioneq_changed (line 8915) | int stb_bitset_unioneq_changed(stb_bitset *p0, stb_bitset *p1, int len)
  function stb_bitset (line 8928) | stb_bitset *stb_bitset_new(int value, int len)
  function stb_wordwrap (line 8958) | int stb_wordwrap(int *pairs, int pair_max, int count, char *str)
  type stb_matcher (line 9076) | typedef struct stb_matcher stb_matcher;
  function stb__match_qstring (line 9092) | static int stb__match_qstring(char *candidate, char *qstring, int qlen, ...
  function stb__find_qstring (line 9113) | static int stb__find_qstring(char *candidate, char *qstring, int qlen, i...
  function stb__wildmatch_raw2 (line 9140) | int stb__wildmatch_raw2(char *expr, char *candidate, int search, int ins...
  function stb__wildmatch_raw (line 9228) | int stb__wildmatch_raw(char *expr, char *candidate, int search, int inse...
  function stb_wildmatch (line 9253) | int stb_wildmatch(char *expr, char *candidate)
  function stb_wildmatchi (line 9258) | int stb_wildmatchi(char *expr, char *candidate)
  function stb_wildfind (line 9263) | int stb_wildfind(char *expr, char *candidate)
  function stb_wildfindi (line 9268) | int stb_wildfindi(char *expr, char *candidate)
  type stb_dfa (line 9273) | typedef struct
  type stb_nfa_edge (line 9281) | typedef struct
  type stb_nfa_node (line 9287) | typedef struct
  type stb_matcher (line 9304) | struct stb_matcher
  function stb__add_node (line 9321) | static int stb__add_node(stb_matcher *matcher)
  function stb__add_epsilon (line 9332) | static void stb__add_epsilon(stb_matcher *matcher, int from, int to)
  function stb__add_edge (line 9340) | static void stb__add_edge(stb_matcher *matcher, int from, int to, int type)
  function stb__opt (line 9590) | static int stb__opt(stb_matcher *m, int n)
  function stb__optimize (line 9601) | static void stb__optimize(stb_matcher *m)
  function stb_matcher_free (line 9616) | void stb_matcher_free(stb_matcher *f)
  function stb_matcher (line 9621) | static stb_matcher *stb__alloc_matcher(void)
  function stb__lex_reset (line 9641) | static void stb__lex_reset(stb_matcher *matcher)
  function stb_matcher (line 9650) | stb_matcher *stb_regex_matcher(char *regex)
  function stb_matcher (line 9672) | stb_matcher *stb_lex_matcher(void)
  function stb_lex_item (line 9682) | int stb_lex_item(stb_matcher *matcher, const char *regex, int result)
  function stb_lex_item_wild (line 9698) | int stb_lex_item_wild(stb_matcher *matcher, const char *regex, int result)
  function stb__clear (line 9714) | static void stb__clear(stb_matcher *m, stb_uint16 *list)
  function stb__clear_goalcheck (line 9721) | static int stb__clear_goalcheck(stb_matcher *m, stb_uint16 *list)
  function stb_uint16 (line 9731) | static stb_uint16 * stb__add_if_inactive(stb_matcher *m, stb_uint16 *lis...
  function stb_uint16 (line 9740) | static stb_uint16 * stb__eps_closure(stb_matcher *m, stb_uint16 *list)
  function stb_matcher_match (line 9757) | int stb_matcher_match(stb_matcher *m, char *str)
  function stb_int16 (line 9831) | stb_int16 stb__get_dfa_node(stb_matcher *m, stb_uint16 *list)
  function stb__matcher_dfa (line 9883) | static int stb__matcher_dfa(stb_matcher *m, char *str_c, int *len)
  function stb_matcher_find (line 10036) | int stb_matcher_find(stb_matcher *m, char *str)
  function stb_lex (line 10042) | int stb_lex(stb_matcher *m, char *str, int *len)
  function stb_regex (line 10049) | int stb_regex(char *regex, char *str)
  type stb_info_field (line 10103) | typedef struct
  type stb_info_struct (line 10113) | typedef struct
  function stb_introspect_precompiled (line 10152) | void stb_introspect_precompiled(stb_info_struct *compiled)
  function stb__introspect_filename (line 10158) | static void stb__introspect_filename(char *buffer, char *path)
  function stb__introspect_compute (line 10167) | static void stb__introspect_compute(char *path, char *file)
  function stb__introspect (line 10201) | void stb__introspect(char *path, char *file, stb_info_struct *compiled)
  function stb__introspect (line 10301) | void stb__introspect(char *filename)
  function stb_uint (line 10383) | stb_uint stb_decompress_length(stb_uchar *input)
  function stb__match (line 10398) | static void stb__match(stb_uchar *data, stb_uint length)
  function stb__lit (line 10407) | static void stb__lit(stb_uchar *data, stb_uint length)
  function stb_uchar (line 10420) | static stb_uchar *stb_decompress_token(stb_uchar *i)
  function stb_uint (line 10437) | stb_uint stb_decompress(stb_uchar *output, stb_uchar *i, stb_uint length)
  function stb__match (line 10507) | static void stb__match(stb_uchar *data, stb_uint length)
  function stb__lit (line 10516) | static void stb__lit(stb_uchar *data, stb_uint length)
  function sx_match (line 10525) | static void sx_match(stb_uchar *data, stb_uint length)
  function sx_lit (line 10531) | static void sx_lit(stb_uchar *data, stb_uint length)
  function stb_decompress_token_state (line 10536) | static int stb_decompress_token_state(void)
  function stb_matchlen (line 10562) | static unsigned int stb_matchlen(stb_uchar *m1, stb_uchar *m2, stb_uint ...
  function stb__write (line 10576) | static void stb__write(unsigned char v)
  function stb_out2 (line 10584) | static void stb_out2(stb_uint v)
  function stb_out3 (line 10590) | static void stb_out3(stb_uint v) { stb_out(v >> 16); stb_out(v >> 8); st...
  function stb_out4 (line 10591) | static void stb_out4(stb_uint v) { stb_out(v >> 24); stb_out(v >> 16);
  function outliterals (line 10594) | static void outliterals(stb_uchar *in, ptrdiff_t numlit)
  function stb_compress_window (line 10615) | void stb_compress_window(int z)
  function stb_not_crap (line 10622) | static int stb_not_crap(int best, int dist)
  function stb_compress_hashsize (line 10630) | void stb_compress_hashsize(unsigned int y)
  function stb_compress_chunk (line 10645) | static int stb_compress_chunk(stb_uchar *history,
  function stb_compress_inner (line 10749) | static int stb_compress_inner(stb_uchar *input, stb_uint length)
  function stb_uint (line 10784) | stb_uint stb_compress(stb_uchar *out, stb_uchar *input, stb_uint length)
  function stb_compress_tofile (line 10794) | int stb_compress_tofile(char *filename, char *input, unsigned int length)
  function stb_compress_intofile (line 10814) | int stb_compress_intofile(FILE *f, char *input, unsigned int length)
  function stb_out_backpatch_id (line 10835) | static size_t stb_out_backpatch_id(void)
  function stb_out_backpatch (line 10843) | static void stb_out_backpatch(size_t id, stb_uint value)
  function stb_compress_streaming_start (line 10880) | static int stb_compress_streaming_start(void)
  function stb_compress_streaming_end (line 10920) | static int stb_compress_streaming_end(void)
  function stb_write (line 10939) | void stb_write(char *data, int data_len)
  function stb_compress_stream_start (line 11006) | int stb_compress_stream_start(FILE *f)
  function stb_compress_stream_end (line 11020) | void stb_compress_stream_end(int close)
  type stbfile (line 11036) | typedef struct stbfile
  function stb_getc (line 11070) | unsigned int stb_getc(stbfile *f) { return f->getbyte(f); }
  function stb_putc (line 11071) | int stb_putc(stbfile *f, int ch)  { return f->putbyte(f, ch); }
  function stb_getdata (line 11073) | unsigned int stb_getdata(stbfile *f, void *buffer, unsigned int len)
  function stb_putdata (line 11077) | unsigned int stb_putdata(stbfile *f, void *buffer, unsigned int len)
  function stb_close (line 11081) | void stb_close(stbfile *f)
  function stb_tell (line 11086) | unsigned int stb_tell(stbfile *f) { return f->tell(f); }
  function stb_size (line 11087) | unsigned int stb_size(stbfile *f) { return f->size(f); }
  function stb_backpatch (line 11088) | void stb_backpatch(stbfile *f, unsigned int tell, void *buffer, unsigned...
  function stb__fgetbyte (line 11094) | static int stb__fgetbyte(stbfile *f) { return fgetc(f->f); }
  function stb__fputbyte (line 11095) | static int stb__fputbyte(stbfile *f, int ch) { return fputc(ch, f->f)==0; }
  function stb__fgetdata (line 11096) | static unsigned int stb__fgetdata(stbfile *f, void *buffer, unsigned int...
  function stb__fputdata (line 11097) | static unsigned int stb__fputdata(stbfile *f, void *buffer, unsigned int...
  function stb__fsize (line 11098) | static unsigned int stb__fsize(stbfile *f) { return (unsigned int) stb_f...
  function stb__ftell (line 11099) | static unsigned int stb__ftell(stbfile *f) { return (unsigned int) ftell...
  function stb__fbackpatch (line 11100) | static void stb__fbackpatch(stbfile *f, unsigned int where, void *buffer...
  function stb__fclose (line 11106) | static void         stb__fclose(stbfile *f) { fclose(f->f); }
  function stbfile (line 11108) | stbfile *stb_openf(FILE *f)
  function stb__nogetbyte (line 11122) | static int stb__nogetbyte(stbfile *f) { assert(0); return -1; }
  function stb__nogetdata (line 11123) | static unsigned int stb__nogetdata(stbfile *f, void *buffer, unsigned in...
  function stb__noputbyte (line 11124) | static int stb__noputbyte(stbfile *f, int ch) { assert(0); return 0; }
  function stb__noputdata (line 11125) | static unsigned int stb__noputdata(stbfile *f, void *buffer, unsigned in...
  function stb__nobackpatch (line 11126) | static void stb__nobackpatch(stbfile *f, unsigned int where, void *buffe...
  function stb__bgetbyte (line 11128) | static int stb__bgetbyte(stbfile *s)
  function stb__bgetdata (line 11136) | static unsigned int stb__bgetdata(stbfile *s, void *buffer, unsigned int...
  function stb__bsize (line 11144) | static unsigned int stb__bsize(stbfile *s) { return (unsigned int) (s->i...
  function stb__btell (line 11145) | static unsigned int stb__btell(stbfile *s) { return (unsigned int) (s->i...
  function stb__bclose (line 11147) | static void stb__bclose(stbfile *s)
  function stbfile (line 11153) | stbfile *stb_open_inbuffer(void *buffer, unsigned int len)
  function stbfile (line 11168) | stbfile *stb_open_inbuffer_free(void *buffer, unsigned int len)
  function stb__fclose2 (line 11179) | static void stb__fclose2(stbfile *f)
  function stbfile (line 11184) | stbfile *stb_open(char *filename, char *mode)
  function stb__fclose2 (line 11197) | static void stb__fclose2(stbfile *f)
  function stbfile (line 11202) | stbfile *stb_open(char *filename, char *mode)
  function stb__aputbyte (line 11215) | static int stb__aputbyte(stbfile *f, int ch)
  function stb__aputdata (line 11220) | static unsigned int stb__aputdata(stbfile *f, void *data, unsigned int len)
  function stb__asize (line 11225) | static unsigned int stb__asize(stbfile *f) { return stb_arr_len(f->buffe...
  function stb__abackpatch (line 11226) | static void stb__abackpatch(stbfile *f, unsigned int where, void *data, ...
  function stb__aclose (line 11230) | static void stb__aclose(stbfile *f)
  function stbfile (line 11235) | stbfile *stb_open_outbuffer(unsigned char **update_on_close)
  type stb_arith (line 11256) | typedef struct
  type stb_arith_symstate_item (line 11283) | typedef struct
  type stb_arith_symstate (line 11289) | typedef struct
  function stb_arith_init_encode (line 11298) | void stb_arith_init_encode(stb_arith *a, stbfile *out)
  function stb__arith_carry (line 11306) | static void stb__arith_carry(stb_arith *a)
  function stb__arith_putbyte (line 11315) | static void stb__arith_putbyte(stb_arith *a, int byte)
  function stb__arith_flush (line 11342) | static void stb__arith_flush(stb_arith *a)
  function stb__renorm_encoder (line 11352) | static void stb__renorm_encoder(stb_arith *a)
  function stb__renorm_decoder (line 11359) | static void stb__renorm_decoder(stb_arith *a)
  function stb_arith_encode (line 11365) | void stb_arith_encode(stb_arith *a, unsigned int totalfreq, unsigned int...
  function stb_arith_encode_log2 (line 11378) | void stb_arith_encode_log2(stb_arith *a, unsigned int totalfreq2, unsign...
  function stb_arith_decode_value (line 11391) | unsigned int stb_arith_decode_value(stb_arith *a, unsigned int totalfreq)
  function stb_arith_decode_advance (line 11398) | void stb_arith_decode_advance(stb_arith *a, unsigned int totalfreq, unsi...
  function stb_arith_decode_value_log2 (line 11407) | unsigned int stb_arith_decode_value_log2(stb_arith *a, unsigned int tota...
  function stb_arith_decode_advance_log2 (line 11414) | void stb_arith_decode_advance_log2(stb_arith *a, unsigned int totalfreq2...
  function stbfile (line 11423) | stbfile *stb_arith_encode_close(stb_arith *a)
  function stbfile (line 11434) | stbfile *stb_arith_decode_close(stb_arith *a)
  type stb__sync (line 11461) | struct stb__sync
  type stb_workqueue (line 11493) | typedef struct stb__workqueue stb_workqueue;
  type stb_threadqueue (line 11524) | typedef struct stb__threadqueue stb_threadqueue;
  type stb__thread (line 11537) | typedef struct
  function stb__threadmutex_init (line 11550) | static void stb__threadmutex_init(void)
  function stb__wait (line 11561) | static void stb__wait(int n)
  function stb_barrier (line 11593) | void stb_barrier(void)
  function stb__thread_run (line 11603) | static void stb__thread_run(void *t)
  function stb_thread (line 11615) | static stb_thread stb_create_thread_raw(stb_thread_func f, void *d, vola...
  function stb_destroy_thread (line 11645) | void          stb_destroy_thread(stb_thread t)   { TerminateThread(t,0); }
  function stb_semaphore (line 11646) | stb_semaphore stb_sem_new(int maxv)                {return CreateSemapho...
  function stb_semaphore (line 11647) | stb_semaphore stb_sem_new_extra(int maxv,int start){return CreateSemapho...
  function stb_sem_delete (line 11648) | void          stb_sem_delete(stb_semaphore s)    { if (s != NULL) CloseH...
  function stb_sem_waitfor (line 11649) | void          stb_sem_waitfor(stb_semaphore s)   { WaitForSingleObject(s...
  function stb_sem_release (line 11650) | void          stb_sem_release(stb_semaphore s)   { ReleaseSemaphore(s,1,...
  function stb__thread_sleep (line 11651) | static void   stb__thread_sleep(int ms)          { Sleep(ms); }
  function stb_processor_count (line 11659) | int stb_processor_count(void)
  function stb_force_uniprocessor (line 11666) | void stb_force_uniprocessor(void)
  function stb_mutex_delete (line 11696) | void stb_mutex_delete(void *p)
  function stb_mutex_begin (line 11704) | void stb_mutex_begin(void *p)
  function stb_mutex_end (line 11711) | void stb_mutex_end(void *p)
  function stb_thread (line 11765) | stb_thread stb_create_thread2(stb_thread_func f, void *d, volatile void ...
  function stb_thread (line 11770) | stb_thread stb_create_thread(stb_thread_func f, void *d)
  function stb_mutex (line 11777) | stb_mutex stb_mutex_new(void)            { return stb_sem_new_extra(1,1); }
  function stb_mutex_delete (line 11778) | void      stb_mutex_delete(stb_mutex m)  { stb_sem_delete (m);      }
  function stb_mutex_begin (line 11779) | void      stb_mutex_begin(stb_mutex m)   { stb__wait(500); if (m) stb_se...
  function stb_mutex_end (line 11780) | void      stb_mutex_end(stb_mutex m)     { if (m) stb_sem_release(m); st...
  type stb__sync (line 11784) | struct stb__sync
  function stb_sync (line 11797) | stb_sync stb_sync_new(void)
  function stb_sync_delete (line 11816) | void stb_sync_delete(stb_sync s)
  function stb_sync_set_target (line 11828) | int stb_sync_set_target(stb_sync s, int count)
  function stb__sync_release (line 11850) | void stb__sync_release(stb_sync s)
  function stb_sync_reach (line 11860) | int stb_sync_reach(stb_sync s)
  function stb_sync_reach_and_wait (line 11872) | void stb_sync_reach_and_wait(stb_sync s)
  type stb__threadqueue (line 11895) | struct stb__threadqueue
  function stb__tq_wrap (line 11906) | static int stb__tq_wrap(volatile stb_threadqueue *z, int p)
  function stb__threadq_get_raw (line 11914) | int stb__threadq_get_raw(stb_threadqueue *tq2, void *output, int block)
  function stb__threadq_grow (line 11947) | int stb__threadq_grow(volatile stb_threadqueue *tq)
  function stb__threadq_add_raw (line 11972) | int stb__threadq_add_raw(stb_threadqueue *tq2, void *input, int block)
  function stb_threadq_length (line 12011) | int stb_threadq_length(stb_threadqueue *tq2)
  function stb_threadq_get (line 12024) | int stb_threadq_get(stb_threadqueue *tq, void *output)
  function stb_threadq_get_block (line 12029) | void stb_threadq_get_block(stb_threadqueue *tq, void *output)
  function stb_threadq_add (line 12034) | int stb_threadq_add(stb_threadqueue *tq, void *input)
  function stb_threadq_add_block (line 12039) | int stb_threadq_add_block(stb_threadqueue *tq, void *input)
  function stb_threadq_delete (line 12044) | void stb_threadq_delete(stb_threadqueue *tq)
  function stb_threadqueue (line 12057) | stb_threadqueue *stb_threadq_new(int item_size, int num_items, int many_...
  type stb__workinfo (line 12094) | typedef struct
  type stb__workqueue (line 12104) | struct stb__workqueue
  function stb_workqueue (line 12127) | stb_workqueue *stb_workq_new(int num_threads, int max_units)
  function stb_workqueue (line 12132) | stb_workqueue *stb_workq_new_flags(int numthreads, int max_units, int no...
  function stb_workq_delete (line 12143) | void stb_workq_delete(stb_workqueue *q)
  function stb_work_init (line 12153) | static void stb_work_init(int num_threads)
  function stb__work_raw (line 12165) | static int stb__work_raw(stb_workqueue *q, stb_thread_func f, void *d, v...
  function stb_workq_length (line 12179) | int stb_workq_length(stb_workqueue *q)
  function stb_workq (line 12184) | int stb_workq(stb_workqueue *q, stb_thread_func f, void *d, volatile voi...
  function stb_workq_reach (line 12190) | int stb_workq_reach(stb_workqueue *q, stb_thread_func f, void *d, volati...
  function stb__workq_numthreads (line 12196) | static void stb__workq_numthreads(stb_workqueue *q, int n)
  function stb_workq_numthreads (line 12208) | void stb_workq_numthreads(stb_workqueue *q, int n)
  function stb_work_maxunits (line 12215) | int stb_work_maxunits(int n)
  function stb_work (line 12224) | int stb_work(stb_thread_func f, void *d, volatile void **return_code)
  function stb_work_reach (line 12229) | int stb_work_reach(stb_thread_func f, void *d, volatile void **return_co...
  function stb_work_numthreads (line 12234) | void stb_work_numthreads(int n)
  type stb_bgstat (line 12256) | typedef struct
  function stb_thread_cleanup (line 12272) | void stb_thread_cleanup(void)
  type stb__disk_command (line 12282) | typedef struct
  function stb__io_init (line 12300) | void stb__io_init(void)
  type _stati64 (line 12331) | struct _stati64
  function stb__io_add (line 12389) | int stb__io_add(char *fname, FILE *f, int off, int len, stb_uchar *out, ...
  function stb_bgio_read (line 12415) | int stb_bgio_read(char *filename, int offset, int len, stb_uchar **resul...
  function stb_bgio_readf (line 12420) | int stb_bgio_readf(FILE *f, int offset, int len, stb_uchar **result, int...
  function stb_bgio_read_to (line 12425) | int stb_bgio_read_to(char *filename, int offset, int len, stb_uchar *buf...
  function stb_bgio_readf_to (line 12430) | int stb_bgio_readf_to(FILE *f, int offset, int len, stb_uchar *buffer, i...
  function STB_EXTERN (line 12435) | STB_EXTERN int stb_bgio_stat    (char *filename, stb_bgstat *result)
  type stb__span (line 12476) | typedef struct stb__span
  function stb__update_page_range (line 12487) | static void stb__update_page_range(int first, int last)
  function stb__span (line 12517) | static stb__span *stb__span_alloc(void)
  function stb__spanlist_unlink (line 12536) | static void stb__spanlist_unlink(stb__span *s)
  function stb__spanlist_add (line 12551) | static void stb__spanlist_add(int n, stb__span *s)
  function stb__set_span_for_page (line 12565) | static void stb__set_span_for_page(stb__span *s)
  function stb__span (line 12572) | static stb__span *stb__coalesce(stb__span *a, stb__span *b)
  function stb__free_span (line 12585) | static void stb__free_span(stb__span *s)
  function stb__span (line 12600) | static stb__span *stb__alloc_pages(int num)
  function stb__span (line 12618) | static stb__span *stb__alloc_span(int pagecount)
  function stb__span (line 12660) | stb__span *stb__get_nonempty_sizeclass(int c)
  function stb__sizeclass (line 12696) | static int stb__sizeclass(size_t sz)
  function stb__init_sizeclass (line 12702) | static void stb__init_sizeclass(void)
  function stb_ssize (line 12776) | int stb_ssize(void *p)
  function stb_sfree (line 12789) | void stb_sfree(void *p)
  function stb_source_path (line 12877) | void stb_source_path(char *path)
  type stb__Entry (line 12926) | typedef struct
  type stb__FileEntry (line 12937) | typedef struct
  function stb__constant_parse (line 12947) | static void stb__constant_parse(stb__FileEntry *f, int i)
  function stb__Entry (line 12998) | stb__Entry *stb__constant_get_entry(char *filename, int line, int type)
  function stb__double_constant (line 13044) | double stb__double_constant(char *file, int line, double x)
  function stb__int_constant (line 13051) | int    stb__int_constant(char *file, int line, int x)

FILE: deprecated/stb_image.c
  type stbi_uc (line 212) | typedef unsigned char stbi_uc;
  type stbi_io_callbacks (line 235) | typedef struct
  type stbi__uint8 (line 367) | typedef unsigned char  stbi__uint8;
  type stbi__uint16 (line 368) | typedef unsigned short stbi__uint16;
  type stbi__int16 (line 369) | typedef   signed short stbi__int16;
  type stbi__uint32 (line 370) | typedef unsigned int   stbi__uint32;
  type stbi__int32 (line 371) | typedef   signed int   stbi__int32;
  type stbi__uint8 (line 374) | typedef uint8_t  stbi__uint8;
  type stbi__uint16 (line 375) | typedef uint16_t stbi__uint16;
  type stbi__int16 (line 376) | typedef int16_t  stbi__int16;
  type stbi__uint32 (line 377) | typedef uint32_t stbi__uint32;
  type stbi__int32 (line 378) | typedef int32_t  stbi__int32;
  type stbi (line 406) | typedef struct
  function start_mem (line 426) | static void start_mem(stbi *s, stbi__uint8 const *buffer, int len)
  function start_callbacks (line 435) | static void start_callbacks(stbi *s, stbi_io_callbacks *c, void *user)
  function stdio_read (line 447) | static int stdio_read(void *user, char *data, int size)
  function stdio_skip (line 452) | static void stdio_skip(void *user, int n)
  function stdio_eof (line 457) | static int stdio_eof(void *user)
  function start_file (line 469) | static void start_file(stbi *s, FILE *f)
  function stbi_rewind (line 478) | static void stbi_rewind(stbi *s)
  function e (line 518) | static int e(const char *str)
  function stbi_image_free (line 539) | void stbi_image_free(void *retval_from_stbi_load)
  function stbi_is_hdr_from_memory (line 664) | int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
  function stbi_is_hdr (line 678) | extern int      stbi_is_hdr          (char const *filename)
  function stbi_is_hdr_from_file (line 689) | extern int      stbi_is_hdr_from_file(FILE *f)
  function stbi_is_hdr_from_callbacks (line 701) | extern int      stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk...
  function stbi_hdr_to_ldr_gamma (line 716) | void   stbi_hdr_to_ldr_gamma(float gamma) { h2l_gamma_i = 1/gamma; }
  function stbi_hdr_to_ldr_scale (line 717) | void   stbi_hdr_to_ldr_scale(float scale) { h2l_scale_i = 1/scale; }
  function stbi_ldr_to_hdr_gamma (line 719) | void   stbi_ldr_to_hdr_gamma(float gamma) { l2h_gamma = gamma; }
  function stbi_ldr_to_hdr_scale (line 720) | void   stbi_ldr_to_hdr_scale(float scale) { l2h_scale = scale; }
  function refill_buffer (line 736) | static void refill_buffer(stbi *s)
  function stbi_inline (line 752) | stbi_inline static int get8(stbi *s)
  function stbi_inline (line 763) | stbi_inline static int at_eof(stbi *s)
  function stbi_inline (line 775) | stbi_inline static stbi__uint8 get8u(stbi *s)
  function skip (line 780) | static void skip(stbi *s, int n)
  function getn (line 793) | static int getn(stbi *s, stbi_uc *buffer, int n)
  function get16 (line 817) | static int get16(stbi *s)
  function stbi__uint32 (line 823) | static stbi__uint32 get32(stbi *s)
  function get16le (line 829) | static int get16le(stbi *s)
  function stbi__uint32 (line 835) | static stbi__uint32 get32le(stbi *s)
  function stbi__uint8 (line 852) | static stbi__uint8 compute_y(int r, int g, int b)
  function stbi_uc (line 920) | static stbi_uc *hdr_to_ldr(float   *data, int x, int y, int comp)
  type huffman (line 976) | typedef struct
  type jpeg (line 987) | typedef struct
  function build_huffman (line 1026) | static int build_huffman(huffman *h, int *count)
  function grow_buffer_unsafe (line 1067) | static void grow_buffer_unsafe(jpeg *j)
  function stbi_inline (line 1088) | stbi_inline static int decode(jpeg *j, huffman *h)
  function stbi_inline (line 1139) | stbi_inline static int extend_receive(jpeg *j, int n)
  function decode_block (line 1182) | static int decode_block(jpeg *j, short data[64], huffman *hdc, huffman *...
  function stbi_inline (line 1217) | stbi_inline static stbi__uint8 clamp(int x)
  type stbi_dequantize_t (line 1269) | typedef unsigned short stbi_dequantize_t;
  type stbi__uint8 (line 1271) | typedef stbi__uint8 stbi_dequantize_t;
  function idct_block (line 1275) | static void idct_block(stbi__uint8 *out, int out_stride, short data[64],...
  function stbi_install_idct (line 1339) | void stbi_install_idct(stbi_idct_8x8 func)
  function stbi__uint8 (line 1349) | static stbi__uint8 get_marker(jpeg *j)
  function reset (line 1366) | static void reset(jpeg *j)
  function parse_entropy_coded_data (line 1378) | static int parse_entropy_coded_data(jpeg *z)
  function process_marker (line 1450) | static int process_marker(jpeg *z, int m)
  function process_scan_header (line 1519) | static int process_scan_header(jpeg *z)
  function process_frame_header (line 1544) | static int process_frame_header(jpeg *z, int scan)
  function decode_jpeg_header (line 1623) | static int decode_jpeg_header(jpeg *z, int scan)
  function decode_jpeg_image (line 1644) | static int decode_jpeg_image(jpeg *j)
  type stbi__uint8 (line 1677) | typedef stbi__uint8 *(*resample_row_func)(stbi__uint8 *out, stbi__uint8 ...
  function stbi__uint8 (line 1682) | static stbi__uint8 *resample_row_1(stbi__uint8 *out, stbi__uint8 *in_nea...
  function stbi__uint8 (line 1691) | static stbi__uint8* resample_row_v_2(stbi__uint8 *out, stbi__uint8 *in_n...
  function stbi__uint8 (line 1701) | static stbi__uint8*  resample_row_h_2(stbi__uint8 *out, stbi__uint8 *in_...
  function stbi__uint8 (line 1731) | static stbi__uint8 *resample_row_hv_2(stbi__uint8 *out, stbi__uint8 *in_...
  function stbi__uint8 (line 1755) | static stbi__uint8 *resample_row_generic(stbi__uint8 *out, stbi__uint8 *...
  function YCbCr_to_RGB_row (line 1770) | static void YCbCr_to_RGB_row(stbi__uint8 *out, const stbi__uint8 *y, con...
  function stbi_install_YCbCr_to_RGB (line 1798) | void stbi_install_YCbCr_to_RGB(stbi_YCbCr_to_RGB_run func)
  function cleanup_jpeg (line 1806) | static void cleanup_jpeg(jpeg *j)
  type stbi_resample (line 1821) | typedef struct
  function stbi__uint8 (line 1831) | static stbi__uint8 *load_jpeg_image(jpeg *z, int *out_x, int *out_y, int...
  function stbi_jpeg_test (line 1938) | static int stbi_jpeg_test(stbi *s)
  function stbi_jpeg_info_raw (line 1948) | static int stbi_jpeg_info_raw(jpeg *j, int *x, int *y, int *comp)
  function stbi_jpeg_info (line 1960) | static int stbi_jpeg_info(stbi *s, int *x, int *y, int *comp)
  type zhuffman (line 1980) | typedef struct
  function stbi_inline (line 1990) | stbi_inline static int bitreverse16(int n)
  function stbi_inline (line 1999) | stbi_inline static int bit_reverse(int v, int bits)
  function zbuild_huffman (line 2007) | static int zbuild_huffman(zhuffman *z, stbi__uint8 *sizelist, int num)
  type zbuf (line 2058) | typedef struct
  function stbi_inline (line 2072) | stbi_inline static int zget8(zbuf *z)
  function fill_bits (line 2078) | static void fill_bits(zbuf *z)
  function zreceive (line 2087) | int zreceive(zbuf *z, int n)
  function stbi_inline (line 2097) | stbi_inline static int zhuffman_decode(zbuf *a, zhuffman *z)
  function expand (line 2124) | static int expand(zbuf *z, int n)  // need to make room for n bytes
  function parse_huffman_block (line 2155) | static int parse_huffman_block(zbuf *a)
  function compute_huffman_codes (line 2183) | static int compute_huffman_codes(zbuf *a)
  function parse_uncompressed_block (line 2229) | static int parse_uncompressed_block(zbuf *a)
  function parse_zlib_header (line 2258) | static int parse_zlib_header(zbuf *a)
  function init_defaults (line 2273) | static void init_defaults(void)
  function parse_zlib (line 2285) | static int parse_zlib(zbuf *a, int parse_header)
  function do_zlib (line 2316) | static int do_zlib(zbuf *a, char *obuf, int olen, int exp, int parse_hea...
  function stbi_zlib_decode_buffer (line 2363) | int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer...
  function stbi_zlib_decode_noheader_buffer (line 2390) | int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char...
  type chunk (line 2412) | typedef struct
  function chunk (line 2420) | static chunk get_chunk_header(stbi *s)
  function check_png_header (line 2428) | static int check_png_header(stbi *s)
  type png (line 2437) | typedef struct
  function paeth (line 2454) | static int paeth(int a, int b, int c)
  function create_png_image_raw (line 2466) | static int create_png_image_raw(png *a, stbi__uint8 *raw, stbi__uint32 r...
  function create_png_image (line 2543) | static int create_png_image(png *a, stbi__uint8 *raw, stbi__uint32 raw_l...
  function compute_transparency (line 2584) | static int compute_transparency(png *z, stbi__uint8 tc[3], int out_n)
  function expand_palette (line 2609) | static int expand_palette(png *a, stbi__uint8 *palette, int len, int pal...
  function stbi_set_unpremultiply_on_load (line 2649) | void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply)
  function stbi_convert_iphone_png_to_rgb (line 2653) | void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
  function stbi_de_iphone (line 2658) | static void stbi_de_iphone(png *z)
  function parse_png_file (line 2700) | static int parse_png_file(png *z, int scan, int req_comp)
  function stbi_png_test (line 2883) | static int stbi_png_test(stbi *s)
  function stbi_png_info_raw (line 2891) | static int stbi_png_info_raw(png *p, int *x, int *y, int *comp)
  function stbi_png_info (line 2903) | static int      stbi_png_info(stbi *s, int *x, int *y, int *comp)
  function bmp_test (line 2912) | static int bmp_test(stbi *s)
  function stbi_bmp_test (line 2926) | static int stbi_bmp_test(stbi *s)
  function high_bit (line 2935) | static int high_bit(unsigned int z)
  function bitcount (line 2947) | static int bitcount(unsigned int a)
  function shiftsigned (line 2957) | static int shiftsigned(int v, int shift, int bits)
  function stbi_uc (line 2974) | static stbi_uc *bmp_load(stbi *s, int *x, int *y, int *comp, int req_comp)
  function stbi_uc (line 3170) | static stbi_uc *stbi_bmp_load(stbi *s,int *x, int *y, int *comp, int req...
  function tga_info (line 3179) | static int tga_info(stbi *s, int *x, int *y, int *comp)
  function stbi_tga_info (line 3216) | int stbi_tga_info(stbi *s, int *x, int *y, int *comp)
  function tga_test (line 3221) | static int tga_test(stbi *s)
  function stbi_tga_test (line 3241) | static int stbi_tga_test(stbi *s)
  function stbi_uc (line 3248) | static stbi_uc *tga_load(stbi *s, int *x, int *y, int *comp, int req_comp)
  function stbi_uc (line 3442) | static stbi_uc *stbi_tga_load(stbi *s, int *x, int *y, int *comp, int re...
  function psd_test (line 3451) | static int psd_test(stbi *s)
  function stbi_psd_test (line 3457) | static int stbi_psd_test(stbi *s)
  function stbi_uc (line 3464) | static stbi_uc *psd_load(stbi *s, int *x, int *y, int *comp, int req_comp)
  function stbi_uc (line 3622) | static stbi_uc *stbi_psd_load(stbi *s, int *x, int *y, int *comp, int re...
  function pic_is4 (line 3634) | static int pic_is4(stbi *s,const char *str)
  function pic_test (line 3644) | static int pic_test(stbi *s)
  type pic_packet_t (line 3660) | typedef struct
  function stbi_uc (line 3665) | static stbi_uc *pic_readval(stbi *s, int channel, stbi_uc *dest)
  function pic_copyval (line 3679) | static void pic_copyval(int channel,stbi_uc *dest,const stbi_uc *src)
  function stbi_uc (line 3688) | static stbi_uc *pic_load2(stbi *s,int width,int height,int *comp, stbi_u...
  function stbi_uc (line 3799) | static stbi_uc *pic_load(stbi *s,int *px,int *py,int *comp,int req_comp)
  function stbi_pic_test (line 3832) | static int stbi_pic_test(stbi *s)
  function stbi_uc (line 3839) | static stbi_uc *stbi_pic_load(stbi *s, int *x, int *y, int *comp, int re...
  type stbi_gif_lzw (line 3846) | typedef struct stbi_gif_lzw_struct {
  type stbi_gif (line 3852) | typedef struct stbi_gif_struct
  function gif_test (line 3869) | static int gif_test(stbi *s)
  function stbi_gif_test (line 3879) | static int stbi_gif_test(stbi *s)
  function stbi_gif_parse_colortable (line 3886) | static void stbi_gif_parse_colortable(stbi *s, stbi__uint8 pal[256][4], ...
  function stbi_gif_header (line 3897) | static int stbi_gif_header(stbi *s, stbi_gif *g, int *comp, int is_info)
  function stbi_gif_info_raw (line 3925) | static int stbi_gif_info_raw(stbi *s, int *x, int *y, int *comp)
  function stbi_out_gif_code (line 3937) | static void stbi_out_gif_code(stbi_gif *g, stbi__uint16 code)
  function stbi__uint8 (line 3971) | static stbi__uint8 *stbi_process_gif_raster(stbi *s, stbi_gif *g)
  function stbi_fill_gif_background (line 4050) | static void stbi_fill_gif_background(stbi_gif *g)
  function stbi__uint8 (line 4065) | static stbi__uint8 *stbi_gif_load_next(stbi *s, stbi_gif *g, int *comp, ...
  function stbi_uc (line 4165) | static stbi_uc *stbi_gif_load(stbi *s, int *x, int *y, int *comp, int re...
  function stbi_gif_info (line 4180) | static int stbi_gif_info(stbi *s, int *x, int *y, int *comp)
  function hdr_test (line 4190) | static int hdr_test(stbi *s)
  function stbi_hdr_test (line 4200) | static int stbi_hdr_test(stbi* s)
  function hdr_convert (line 4230) | static void hdr_convert(float *output, stbi_uc *input, int req_comp)
  function stbi_hdr_info (line 4373) | static int stbi_hdr_info(stbi *s, int *x, int *y, int *comp)
  function stbi_bmp_info (line 4413) | static int stbi_bmp_info(stbi *s, int *x, int *y, int *comp)
  function stbi_psd_info (line 4441) | static int stbi_psd_info(stbi *s, int *x, int *y, int *comp)
  function stbi_pic_info (line 4472) | static int stbi_pic_info(stbi *s, int *x, int *y, int *comp)
  function stbi_info_main (line 4517) | static int stbi_info_main(stbi *s, int *x, int *y, int *comp)
  function stbi_info (line 4542) | int stbi_info(char const *filename, int *x, int *y, int *comp)
  function stbi_info_from_file (line 4552) | int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
  function stbi_info_from_memory (line 4564) | int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y...
  function stbi_info_from_callbacks (line 4571) | int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int...

FILE: deprecated/stb_image_resize.h
  type stbir_uint8 (line 188) | typedef unsigned char  stbir_uint8;
  type stbir_uint16 (line 189) | typedef unsigned short stbir_uint16;
  type stbir_uint32 (line 190) | typedef unsigned int   stbir_uint32;
  type stbir_uint8 (line 193) | typedef uint8_t  stbir_uint8;
  type stbir_uint16 (line 194) | typedef uint16_t stbir_uint16;
  type stbir_uint32 (line 195) | typedef uint32_t stbir_uint32;
  type stbir_edge (line 258) | typedef enum
  type stbir_filter (line 287) | typedef enum
  type stbir_colorspace (line 297) | typedef enum
  type stbir_datatype (line 340) | typedef enum
  type stbir__filter_info (line 478) | typedef struct
  type stbir__contributors (line 486) | typedef struct
  type stbir__info (line 492) | typedef struct
  function stbir__inline (line 567) | static stbir__inline int stbir__min(int a, int b)
  function stbir__inline (line 572) | static stbir__inline float stbir__saturate(float x)
  function stbir__inline (line 584) | static stbir__inline stbir_uint8 stbir__saturate8(int x)
  function stbir__inline (line 595) | static stbir__inline stbir_uint16 stbir__saturate16(int x)
  function stbir__srgb_to_linear (line 634) | static float stbir__srgb_to_linear(float f)
  function stbir__linear_to_srgb (line 642) | static float stbir__linear_to_srgb(float f)
  type stbir__FP32 (line 653) | typedef union
  function stbir_uint8 (line 675) | static stbir_uint8 stbir__linear_to_srgb_uchar(float in)
  function stbir_uint8 (line 739) | static stbir_uint8 stbir__linear_to_srgb_uchar(float f)
  function stbir__filter_trapezoid (line 759) | static float stbir__filter_trapezoid(float x, float scale)
  function stbir__support_trapezoid (line 779) | static float stbir__support_trapezoid(float scale)
  function stbir__filter_triangle (line 785) | static float stbir__filter_triangle(float x, float s)
  function stbir__filter_cubic (line 797) | static float stbir__filter_cubic(float x, float s)
  function stbir__filter_catmullrom (line 811) | static float stbir__filter_catmullrom(float x, float s)
  function stbir__filter_mitchell (line 825) | static float stbir__filter_mitchell(float x, float s)
  function stbir__support_zero (line 839) | static float stbir__support_zero(float s)
  function stbir__support_one (line 845) | static float stbir__support_one(float s)
  function stbir__support_two (line 851) | static float stbir__support_two(float s)
  function stbir__inline (line 866) | stbir__inline static int stbir__use_upsampling(float ratio)
  function stbir__inline (line 871) | stbir__inline static int stbir__use_width_upsampling(stbir__info* stbir_...
  function stbir__inline (line 876) | stbir__inline static int stbir__use_height_upsampling(stbir__info* stbir...
  function stbir__get_filter_pixel_width (line 883) | static int stbir__get_filter_pixel_width(stbir_filter filter, float scale)
  function stbir__get_filter_pixel_margin (line 896) | static int stbir__get_filter_pixel_margin(stbir_filter filter, float scale)
  function stbir__get_coefficient_width (line 901) | static int stbir__get_coefficient_width(stbir_filter filter, float scale)
  function stbir__get_contributors (line 909) | static int stbir__get_contributors(float scale, stbir_filter filter, int...
  function stbir__get_total_horizontal_coefficients (line 917) | static int stbir__get_total_horizontal_coefficients(stbir__info* info)
  function stbir__get_total_vertical_coefficients (line 923) | static int stbir__get_total_vertical_coefficients(stbir__info* info)
  function stbir__contributors (line 929) | static stbir__contributors* stbir__get_contributor(stbir__contributors* ...
  function stbir__edge_wrap_slow (line 942) | static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
  function stbir__inline (line 1000) | stbir__inline static int stbir__edge_wrap(stbir_edge edge, int n, int max)
  function stbir__calculate_sample_range_upsample (line 1009) | static void stbir__calculate_sample_range_upsample(int n, float out_filt...
  function stbir__calculate_sample_range_downsample (line 1024) | static void stbir__calculate_sample_range_downsample(int n, float in_pix...
  function stbir__calculate_coefficients_upsample (line 1038) | static void stbir__calculate_coefficients_upsample(stbir_filter filter, ...
  function stbir__calculate_coefficients_downsample (line 1092) | static void stbir__calculate_coefficients_downsample(stbir_filter filter...
  function stbir__normalize_downsample_coefficients (line 1126) | static void stbir__normalize_downsample_coefficients(stbir__contributors...
  function stbir__calculate_filters (line 1203) | static void stbir__calculate_filters(stbir__contributors* contributors, ...
  function stbir__decode_scanline (line 1252) | static void stbir__decode_scanline(stbir__info* stbir_info, int n)
  function stbir__resample_horizontal_upsample (line 1450) | static void stbir__resample_horizontal_upsample(stbir__info* stbir_info,...
  function stbir__resample_horizontal_downsample (line 1533) | static void stbir__resample_horizontal_downsample(stbir__info* stbir_inf...
  function stbir__decode_and_resample_upsample (line 1658) | static void stbir__decode_and_resample_upsample(stbir__info* stbir_info,...
  function stbir__decode_and_resample_downsample (line 1672) | static void stbir__decode_and_resample_downsample(stbir__info* stbir_inf...
  function stbir__encode_scanline (line 1696) | static void stbir__encode_scanline(stbir__info* stbir_info, int num_pixe...
  function stbir__resample_vertical_upsample (line 1870) | static void stbir__resample_vertical_upsample(stbir__info* stbir_info, i...
  function stbir__resample_vertical_downsample (line 1987) | static void stbir__resample_vertical_downsample(stbir__info* stbir_info,...
  function stbir__buffer_loop_upsample (line 2067) | static void stbir__buffer_loop_upsample(stbir__info* stbir_info)
  function stbir__empty_ring_buffer (line 2120) | static void stbir__empty_ring_buffer(stbir__info* stbir_info, int first_...
  function stbir__buffer_loop_downsample (line 2165) | static void stbir__buffer_loop_downsample(stbir__info* stbir_info)
  function stbir__setup (line 2206) | static void stbir__setup(stbir__info *info, int input_w, int input_h, in...
  function stbir__calculate_transform (line 2215) | static void stbir__calculate_transform(stbir__info *info, float s0, floa...
  function stbir__choose_filter (line 2239) | static void stbir__choose_filter(stbir__info *info, stbir_filter h_filte...
  function stbir_uint32 (line 2249) | static stbir_uint32 stbir__calculate_memory(stbir__info *info)
  function stbir__resize_allocated (line 2290) | static int stbir__resize_allocated(stbir__info *info,
  function stbir__resize_arbitrary (line 2428) | static int stbir__resize_arbitrary(
  function STBIRDEF (line 2462) | STBIRDEF int stbir_resize_uint8(     const unsigned char *input_pixels ,...
  function STBIRDEF (line 2472) | STBIRDEF int stbir_resize_float(     const float *input_pixels , int inp...
  function STBIRDEF (line 2482) | STBIRDEF int stbir_resize_uint8_srgb(const unsigned char *input_pixels ,...
  function STBIRDEF (line 2492) | STBIRDEF int stbir_resize_uint8_srgb_edgemode(const unsigned char *input...
  function STBIRDEF (line 2503) | STBIRDEF int stbir_resize_uint8_generic( const unsigned char *input_pixe...
  function STBIRDEF (line 2515) | STBIRDEF int stbir_resize_uint16_generic(const stbir_uint16 *input_pixel...
  function STBIRDEF (line 2528) | STBIRDEF int stbir_resize_float_generic( const float *input_pixels      ...
  function STBIRDEF (line 2541) | STBIRDEF int stbir_resize(         const void *input_pixels , int input_...
  function STBIRDEF (line 2556) | STBIRDEF int stbir_resize_subpixel(const void *input_pixels , int input_...
  function STBIRDEF (line 2577) | STBIRDEF int stbir_resize_region(  const void *input_pixels , int input_...

FILE: deprecated/stretch_test.c
  function main (line 9) | int main(int arg, char **argv)

FILE: stb_c_lexer.h
  type stb_lexer (line 113) | typedef struct
  type stb_lex_location (line 134) | typedef struct
  type stb__clex_int (line 221) | typedef double     stb__clex_int;
  type stb__clex_int (line 225) | typedef long       stb__clex_int;
  function stb_c_lexer_init (line 273) | void stb_c_lexer_init(stb_lexer *lexer, const char *input_stream, const ...
  function stb_c_lexer_get_location (line 283) | void stb_c_lexer_get_location(const stb_lexer *lexer, const char *where,...
  function stb__clex_token (line 303) | static int stb__clex_token(stb_lexer *lexer, int token, char *start, cha...
  function stb__clex_eof (line 313) | static int stb__clex_eof(stb_lexer *lexer)
  function stb__clex_iswhite (line 319) | static int stb__clex_iswhite(int x)
  function stb__clex_parse_suffixes (line 333) | static int stb__clex_parse_suffixes(stb_lexer *lexer, long tokenid, char...
  function stb__clex_pow (line 353) | static double stb__clex_pow(double base, unsigned int exponent)
  function stb__clex_parse_float (line 364) | static double stb__clex_parse_float(char *p, char **q)
  function stb__clex_parse_char (line 448) | static int stb__clex_parse_char(char *p, char **q)
  function stb__clex_parse_string (line 469) | static int stb__clex_parse_string(stb_lexer *lexer, char *p, int type)
  function stb_c_lexer_get_token (line 498) | int stb_c_lexer_get_token(stb_lexer *lexer)
  function print_token (line 808) | static void print_token(stb_lexer *lexer)
  function dummy (line 858) | extern /**/
  function main (line 875) | int main(int argc, char **argv)

FILE: stb_connected_components.h
  type stbcc_grid (line 88) | typedef struct st_stbcc_grid stbcc_grid;
  type stbcc__clumpid (line 199) | typedef unsigned short stbcc__clumpid;
  type stbcc__relative_clumpid (line 222) | typedef struct
  type stbcc__global_clumpid (line 229) | typedef union
  type stbcc__clump (line 243) | typedef struct
  type stbcc__cluster (line 253) | typedef struct
  type st_stbcc_grid (line 262) | struct st_stbcc_grid
  function stbcc_query_grid_node_connection (line 272) | int stbcc_query_grid_node_connection(stbcc_grid *g, int x1, int y1, int ...
  function stbcc_query_grid_open (line 291) | int stbcc_query_grid_open(stbcc_grid *g, int x, int y)
  function stbcc_get_unique_id (line 296) | unsigned int stbcc_get_unique_id(stbcc_grid *g, int x, int y)
  type stbcc__tinypoint (line 306) | typedef struct
  type stbcc__cluster_build_info (line 311) | typedef struct
  function stbcc__global_clumpid (line 321) | static stbcc__global_clumpid stbcc__clump_find(stbcc_grid *g, stbcc__glo...
  type stbcc__unpacked_clumpid (line 334) | typedef struct
  function stbcc__clump_union (line 341) | static void stbcc__clump_union(stbcc_grid *g, stbcc__unpacked_clumpid m,...
  function stbcc__build_connected_components_for_clumps (line 354) | static void stbcc__build_connected_components_for_clumps(stbcc_grid *g)
  function stbcc__build_all_connections_for_cluster (line 407) | static void stbcc__build_all_connections_for_cluster(stbcc_grid *g, int ...
  function stbcc__add_connections_to_adjacent_cluster_with_rebuild (line 519) | static void stbcc__add_connections_to_adjacent_cluster_with_rebuild(stbc...
  function stbcc_update_grid (line 528) | void stbcc_update_grid(stbcc_grid *g, int x, int y, int solid)
  function stbcc_update_batch_begin (line 569) | void stbcc_update_batch_begin(stbcc_grid *g)
  function stbcc_update_batch_end (line 575) | void stbcc_update_batch_end(stbcc_grid *g)
  function stbcc_grid_sizeof (line 582) | size_t stbcc_grid_sizeof(void)
  function stbcc_init_grid (line 587) | void stbcc_init_grid(stbcc_grid *g, unsigned char *map, int w, int h)
  function stbcc__add_clump_connection (line 632) | static void stbcc__add_clump_connection(stbcc_grid *g, int x1, int y1, i...
  function stbcc__remove_clump_connection (line 669) | static void stbcc__remove_clump_connection(stbcc_grid *g, int x1, int y1...
  function stbcc__add_connections_to_adjacent_cluster (line 711) | static void stbcc__add_connections_to_adjacent_cluster(stbcc_grid *g, in...
  function stbcc__remove_connections_to_adjacent_cluster (line 775) | static void stbcc__remove_connections_to_adjacent_cluster(stbcc_grid *g,...
  function stbcc__tinypoint (line 833) | static stbcc__tinypoint stbcc__incluster_find(stbcc__cluster_build_info ...
  function stbcc__incluster_union (line 844) | static void stbcc__incluster_union(stbcc__cluster_build_info *cbi, int x...
  function stbcc__switch_root (line 855) | static void stbcc__switch_root(stbcc__cluster_build_info *cbi, int x, in...
  function stbcc__build_clumps_for_cluster (line 863) | static void stbcc__build_clumps_for_cluster(stbcc_grid *g, int cx, int cy)

FILE: stb_divide.h
  function stb__div (line 128) | int stb__div(int v1, int v2)
  function stb__mod (line 137) | int stb__mod(int v1, int v2)
  function stb_div_trunc (line 147) | int stb_div_trunc(int v1, int v2)
  function stb_div_floor (line 164) | int stb_div_floor(int v1, int v2)
  function stb_div_eucl (line 188) | int stb_div_eucl(int v1, int v2)
  function stb_mod_trunc (line 224) | int stb_mod_trunc(int v1, int v2)
  function stb_mod_floor (line 245) | int stb_mod_floor(int v1, int v2)
  function stb_mod_eucl (line 266) | int stb_mod_eucl(int v1, int v2)
  function stbdiv_check (line 284) | void stbdiv_check(int q, int r, int a, int b, char *type, int dir)
  function test (line 311) | void test(int a, int b)
  function testh (line 323) | void testh(int a, int b)
  function main (line 335) | int main(int argc, char **argv)

FILE: stb_ds.h
  type stbds_string_arena (line 482) | typedef struct stbds_string_arena stbds_string_arena;
  type stbds_array_header (line 657) | typedef struct
  type stbds_string_block (line 665) | typedef struct stbds_string_block
  type stbds_string_arena (line 671) | struct stbds_string_arena
  function T (line 693) | T * stbds_arrgrowf_wrapper(T *a, size_t elemsize, size_t addlen, size_t ...
  function T (line 696) | T * stbds_hmget_key_wrapper(T *a, size_t elemsize, void *key, size_t key...
  function T (line 699) | T * stbds_hmget_key_ts_wrapper(T *a, size_t elemsize, void *key, size_t ...
  function T (line 702) | T * stbds_hmput_default_wrapper(T *a, size_t elemsize) {
  function T (line 705) | T * stbds_hmput_key_wrapper(T *a, size_t elemsize, void *key, size_t key...
  function T (line 708) | T * stbds_hmdel_key_wrapper(T *a, size_t elemsize, void *key, size_t key...
  function T (line 711) | T * stbds_shmode_func_wrapper(T *, size_t elemsize, int mode) {
  function stbds_arrfreef (line 800) | void stbds_arrfreef(void *a)
  type stbds_hash_bucket (line 821) | typedef struct
  type stbds_hash_index (line 827) | typedef struct
  function stbds_rand_seed (line 851) | void stbds_rand_seed(size_t seed)
  function stbds_log2 (line 874) | static size_t stbds_log2(size_t slot_count)
  function stbds_hash_index (line 884) | static stbds_hash_index *stbds_make_hash_index(size_t slot_count, stbds_...
  function stbds_hash_string (line 1016) | size_t stbds_hash_string(char *str, size_t seed)
  function stbds_siphash_bytes (line 1051) | static size_t stbds_siphash_bytes(void *p, size_t len, size_t seed)
  function stbds_hash_bytes (line 1116) | size_t stbds_hash_bytes(void *p, size_t len, size_t seed)
  function stbds_is_key_equal (line 1203) | static int stbds_is_key_equal(void *a, size_t elemsize, void *key, size_...
  function stbds_hmfree_func (line 1216) | void stbds_hmfree_func(void *a, size_t elemsize)
  function stbds_hm_find_slot (line 1232) | static ptrdiff_t stbds_hm_find_slot(void *a, size_t elemsize, void *key,...
  function stbds_strreset (line 1605) | void stbds_strreset(stbds_string_arena *a)
  type stbds_struct (line 1634) | typedef struct { int key,b,c,d; } stbds_struct;
  type stbds_struct2 (line 1635) | typedef struct { int key[2],b,c,d; } stbds_struct2;
  function stbds_unit_tests (line 1648) | void stbds_unit_tests(void)

FILE: stb_dxt.h
  function stb__Mul8Bit (line 164) | static int stb__Mul8Bit(int a, int b)
  function stb__From16Bit (line 170) | static void stb__From16Bit(unsigned char *out, unsigned short v)
  function stb__As16Bit (line 183) | static unsigned short stb__As16Bit(int r, int g, int b)
  function stb__Lerp13 (line 189) | static int stb__Lerp13(int a, int b)
  function stb__Lerp13RGB (line 202) | static void stb__Lerp13RGB(unsigned char *out, unsigned char *p1, unsign...
  function stb__EvalColors (line 211) | static void stb__EvalColors(unsigned char *color,unsigned short c0,unsig...
  function stb__MatchColorsBlock (line 220) | static unsigned int stb__MatchColorsBlock(unsigned char *block, unsigned...
  function stb__OptimizeColorsBlock (line 263) | static void stb__OptimizeColorsBlock(unsigned char *block, unsigned shor...
  function stb__Quantize5 (line 381) | static unsigned short stb__Quantize5(float x)
  function stb__Quantize6 (line 390) | static unsigned short stb__Quantize6(float x)
  function stb__RefineBlock (line 402) | static int stb__RefineBlock(unsigned char *block, unsigned short *pmax16...
  function stb__CompressColorBlock (line 479) | static void stb__CompressColorBlock(unsigned char *dest, unsigned char *...
  function stb__CompressAlphaBlock (line 547) | static void stb__CompressAlphaBlock(unsigned char *dest,unsigned char *s...
  function stb_compress_dxt_block (line 599) | void stb_compress_dxt_block(unsigned char *dest, const unsigned char *sr...
  function stb_compress_bc4_block (line 617) | void stb_compress_bc4_block(unsigned char *dest, const unsigned char *src)
  function stb_compress_bc5_block (line 622) | void stb_compress_bc5_block(unsigned char *dest, const unsigned char *src)
  function main (line 634) | int main()

FILE: stb_easy_font.h
  function print_string (line 91) | void print_string(float x, float y, char *text, float r, float g, float b)
  type stb_easy_font_info_struct (line 112) | struct stb_easy_font_info_struct {
  type stb_easy_font_color (line 168) | typedef struct
  function stb_easy_font_draw_segs (line 173) | static int stb_easy_font_draw_segs(float x, float y, unsigned char *segs...
  function stb_easy_font_spacing (line 194) | static void stb_easy_font_spacing(float spacing)
  function stb_easy_font_print (line 199) | static int stb_easy_font_print(float x, float y, char *text, unsigned ch...
  function stb_easy_font_width (line 230) | static int stb_easy_font_width(char *text)
  function stb_easy_font_height (line 248) | static int stb_easy_font_height(char *text)

FILE: stb_herringbone_wang_tile.h
  type stbhw_tileset (line 167) | typedef struct stbhw_tileset stbhw_tileset;
  type stbhw_tile (line 198) | typedef struct
  type stbhw_tileset (line 210) | struct stbhw_tileset
  type stbhw_config (line 224) | typedef struct
  function STBHW_EXTERN (line 350) | STBHW_EXTERN const char *stbhw_get_last_error(void)
  type stbhw__process (line 369) | struct stbhw__process
  type stbhw__process (line 372) | typedef struct stbhw__process
  function stbhw__process_h_row (line 382) | static void stbhw__process_h_row(stbhw__process *p,
  function stbhw__process_v_row (line 406) | static void stbhw__process_v_row(stbhw__process *p,
  function stbhw__get_template_info (line 430) | static void stbhw__get_template_info(stbhw_config *c, int *w, int *h, in...
  function STBHW_EXTERN (line 478) | STBHW_EXTERN void stbhw_get_template_size(stbhw_config *c, int *w, int *h)
  function stbhw__process_template (line 483) | static int stbhw__process_template(stbhw__process *p)
  function stbhw__draw_pixel (line 568) | static void stbhw__draw_pixel(unsigned char *output, int stride, int x, ...
  function stbhw__draw_h_tile (line 573) | static void stbhw__draw_h_tile(unsigned char *output, int stride, int xm...
  function stbhw__draw_v_tile (line 583) | static void stbhw__draw_v_tile(unsigned char *output, int stride, int xm...
  function stbhw_tile (line 595) | static stbhw_tile * stbhw__choose_tile(stbhw_tile **list, int numlist,
  function stbhw__match (line 642) | static int stbhw__match(int x, int y)
  function stbhw__weighted (line 647) | static int stbhw__weighted(int num_options, int *weights)
  function stbhw__change_color (line 664) | static int stbhw__change_color(int old_color, int num_options, int *weig...
  function STBHW_EXTERN (line 693) | STBHW_EXTERN int stbhw_generate_image(stbhw_tileset *ts, int **weighting...
  function stbhw__parse_h_rect (line 841) | static void stbhw__parse_h_rect(stbhw__process *p, int xpos, int ypos,
  function stbhw__parse_v_rect (line 857) | static void stbhw__parse_v_rect(stbhw__process *p, int xpos, int ypos,
  function STBHW_EXTERN (line 873) | STBHW_EXTERN int stbhw_build_tileset_from_image(stbhw_tileset *ts, unsig...
  function STBHW_EXTERN (line 939) | STBHW_EXTERN void stbhw_free_tileset(stbhw_tileset *ts)
  function stbhw__set_pixel (line 963) | static void stbhw__set_pixel(unsigned char *data, int stride, int xpos, ...
  function stbhw__stbhw__set_pixel_whiten (line 968) | static void stbhw__stbhw__set_pixel_whiten(unsigned char *data, int stri...
  function stbhw__draw_hline (line 997) | static void stbhw__draw_hline(unsigned char *data, int stride, int xpos,...
  function stbhw__draw_vline (line 1014) | static void stbhw__draw_vline(unsigned char *data, int stride, int xpos,...
  function stbhw__draw_clipped_corner (line 1074) | static void stbhw__draw_clipped_corner(unsigned char *data, int stride, ...
  function stbhw__edge_process_h_rect (line 1092) | static void stbhw__edge_process_h_rect(stbhw__process *p, int xpos, int ...
  function stbhw__edge_process_v_rect (line 1104) | static void stbhw__edge_process_v_rect(stbhw__process *p, int xpos, int ...
  function stbhw__corner_process_h_rect (line 1116) | static void stbhw__corner_process_h_rect(stbhw__process *p, int xpos, in...
  function stbhw__corner_process_v_rect (line 1144) | static void stbhw__corner_process_v_rect(stbhw__process *p, int xpos, in...
  function STBHW_EXTERN (line 1173) | STBHW_EXTERN int stbhw_make_template(stbhw_config *c, unsigned char *dat...

FILE: stb_hexwave.h
  type HexWave (line 226) | typedef struct HexWave HexWave;
  type HexWaveParameters (line 259) | typedef struct
  type HexWave (line 267) | struct HexWave
  function STB_HEXWAVE_DEF (line 287) | STB_HEXWAVE_DEF void hexwave_change(HexWave *hex, int reflect, float pea...
  function STB_HEXWAVE_DEF (line 297) | STB_HEXWAVE_DEF void hexwave_create(HexWave *hex, int reflect, float pea...
  function hex_add_oversampled_bleplike (line 315) | static void hex_add_oversampled_bleplike(float *output, float time_since...
  function hex_blep (line 333) | static void hex_blep (float *output, float time_since_transition, float ...
  function hex_blamp (line 338) | static void hex_blamp(float *output, float time_since_transition, float ...
  type hexvert (line 343) | typedef struct
  function hexwave_generate_linesegs (line 350) | static void hexwave_generate_linesegs(hexvert vert[9], HexWave *hex, flo...
  function STB_HEXWAVE_DEF (line 418) | STB_HEXWAVE_DEF void hexwave_generate_samples(float *output, int num_sam...
  function STB_HEXWAVE_DEF (line 546) | STB_HEXWAVE_DEF void hexwave_shutdown(float *user_buffer)
  function STB_HEXWAVE_DEF (line 557) | STB_HEXWAVE_DEF void hexwave_init(int width, int oversample, float *user...

FILE: stb_image.h
  type stbi_uc (line 387) | typedef unsigned char stbi_uc;
  type stbi_us (line 388) | typedef unsigned short stbi_us;
  type stbi_io_callbacks (line 411) | typedef struct
  type stbi__uint16 (line 642) | typedef unsigned short stbi__uint16;
  type stbi__int16 (line 643) | typedef   signed short stbi__int16;
  type stbi__uint32 (line 644) | typedef unsigned int   stbi__uint32;
  type stbi__int32 (line 645) | typedef   signed int   stbi__int32;
  type stbi__uint16 (line 648) | typedef uint16_t stbi__uint16;
  type stbi__int16 (line 649) | typedef int16_t  stbi__int16;
  type stbi__uint32 (line 650) | typedef uint32_t stbi__uint32;
  type stbi__int32 (line 651) | typedef int32_t  stbi__int32;
  function stbi__cpuid3 (line 732) | static int stbi__cpuid3(void)
  function stbi__sse2_available (line 754) | static int stbi__sse2_available(void)
  function stbi__sse2_available (line 765) | static int stbi__sse2_available(void)
  type stbi__context (line 805) | typedef struct
  function stbi__start_mem (line 826) | static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int...
  function stbi__start_callbacks (line 836) | static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c...
  function stbi__stdio_read (line 850) | static int stbi__stdio_read(void *user, char *data, int size)
  function stbi__stdio_skip (line 855) | static void stbi__stdio_skip(void *user, int n)
  function stbi__stdio_eof (line 865) | static int stbi__stdio_eof(void *user)
  function stbi__start_file (line 877) | static void stbi__start_file(stbi__context *s, FILE *f)
  function stbi__rewind (line 886) | static void stbi__rewind(stbi__context *s)
  type stbi__result_info (line 901) | typedef struct
  function STBIDEF (line 972) | STBIDEF const char *stbi_failure_reason(void)
  function stbi__err (line 978) | static int stbi__err(const char *str)
  function stbi__addsizes_valid (line 1002) | static int stbi__addsizes_valid(int a, int b)
  function stbi__mul2sizes_valid (line 1014) | static int stbi__mul2sizes_valid(int a, int b)
  function stbi__mad2sizes_valid (line 1024) | static int stbi__mad2sizes_valid(int a, int b, int add)
  function stbi__mad3sizes_valid (line 1031) | static int stbi__mad3sizes_valid(int a, int b, int c, int add)
  function stbi__mad4sizes_valid (line 1039) | static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)
  function stbi__addints_valid (line 1070) | static int stbi__addints_valid(int a, int b)
  function stbi__mul2shorts_valid (line 1078) | static int stbi__mul2shorts_valid(int a, int b)
  function STBIDEF (line 1101) | STBIDEF void stbi_image_free(void *retval_from_stbi_load)
  function STBIDEF (line 1116) | STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)
  function STBIDEF (line 1126) | STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_sh...
  function stbi_uc (line 1190) | static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, ...
  function stbi__uint16 (line 1206) | static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, ...
  function stbi__vertical_flip (line 1222) | static void stbi__vertical_flip(void *image, int w, int h, int bytes_per...
  function stbi__vertical_flip_slices (line 1247) | static void stbi__vertical_flip_slices(void *image, int w, int h, int z,...
  function stbi__uint16 (line 1286) | static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, ...
  function stbi__float_postprocess (line 1314) | static void stbi__float_postprocess(float *result, int *x, int *y, int *...
  function STBIDEF (line 1331) | STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, c...
  function FILE (line 1337) | static FILE *stbi__fopen(char const *filename, char const *mode)
  function STBIDEF (line 1366) | STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *co...
  function STBIDEF (line 1376) | STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp,...
  function STBIDEF (line 1389) | STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, in...
  function STBIDEF (line 1402) | STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int ...
  function STBIDEF (line 1415) | STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len...
  function STBIDEF (line 1422) | STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *cl...
  function STBIDEF (line 1429) | STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, i...
  function STBIDEF (line 1436) | STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk,...
  function STBIDEF (line 1444) | STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int le...
  function STBIDEF (line 1478) | STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, in...
  function STBIDEF (line 1485) | STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, ...
  function STBIDEF (line 1493) | STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *com...
  function STBIDEF (line 1503) | STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, ...
  function STBIDEF (line 1517) | STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
  function STBIDEF (line 1531) | STBIDEF int      stbi_is_hdr          (char const *filename)
  function STBIDEF (line 1542) | STBIDEF int stbi_is_hdr_from_file(FILE *f)
  function STBIDEF (line 1559) | STBIDEF int      stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clb...
  function STBIDEF (line 1575) | STBIDEF void   stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = ga...
  function STBIDEF (line 1576) | STBIDEF void   stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = sc...
  function STBIDEF (line 1581) | STBIDEF void   stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = ...
  function STBIDEF (line 1582) | STBIDEF void   stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = ...
  function stbi__refill_buffer (line 1597) | static void stbi__refill_buffer(stbi__context *s)
  function stbi_inline (line 1614) | stbi_inline static stbi_uc stbi__get8(stbi__context *s)
  function stbi_inline (line 1628) | stbi_inline static int stbi__at_eof(stbi__context *s)
  function stbi__skip (line 1644) | static void stbi__skip(stbi__context *s, int n)
  function stbi__getn (line 1666) | static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
  function stbi__get16be (line 1694) | static int stbi__get16be(stbi__context *s)
  function stbi__uint32 (line 1704) | static stbi__uint32 stbi__get32be(stbi__context *s)
  function stbi__get16le (line 1714) | static int stbi__get16le(stbi__context *s)
  function stbi__uint32 (line 1722) | static stbi__uint32 stbi__get32le(stbi__context *s)
  function stbi_uc (line 1746) | static stbi_uc stbi__compute_y(int r, int g, int b)
  function stbi__uint16 (line 1803) | static stbi__uint16 stbi__compute_y_16(int r, int g, int b)
  function stbi__uint16 (line 1812) | static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_...
  function stbi_uc (line 1884) | static stbi_uc *stbi__hdr_to_ldr(float   *data, int x, int y, int comp)
  type stbi__huffman (line 1938) | typedef struct
  type stbi__jpeg (line 1949) | typedef struct
  function stbi__build_huffman (line 2003) | static int stbi__build_huffman(stbi__huffman *h, int *count)
  function stbi__build_fast_ac (line 2050) | static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)
  function stbi__grow_buffer_unsafe (line 2075) | static void stbi__grow_buffer_unsafe(stbi__jpeg *j)
  function stbi_inline (line 2097) | stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffm...
  function stbi_inline (line 2153) | stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
  function stbi_inline (line 2169) | stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)
  function stbi_inline (line 2181) | stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
  function stbi__jpeg_decode_block (line 2210) | static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__...
  function stbi__jpeg_decode_block_prog_dc (line 2265) | static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64]...
  function stbi__jpeg_decode_block_prog_ac (line 2295) | static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64]...
  function stbi_inline (line 2416) | stbi_inline static stbi_uc stbi__clamp(int x)
  function stbi__idct_block (line 2467) | static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
  function stbi__idct_simd (line 2530) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
  function stbi__idct_simd (line 2711) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
  function stbi_uc (line 2919) | static stbi_uc stbi__get_marker(stbi__jpeg *j)
  function stbi__jpeg_reset (line 2936) | static void stbi__jpeg_reset(stbi__jpeg *j)
  function stbi__parse_entropy_coded_data (line 2949) | static int stbi__parse_entropy_coded_data(stbi__jpeg *z)
  function stbi__jpeg_dequantize (line 3073) | static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant)
  function stbi__jpeg_finish (line 3080) | static void stbi__jpeg_finish(stbi__jpeg *z)
  function stbi__process_marker (line 3099) | static int stbi__process_marker(stbi__jpeg *z, int m)
  function stbi__process_scan_header (line 3203) | static int stbi__process_scan_header(stbi__jpeg *z)
  function stbi__free_jpeg_components (line 3242) | static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why)
  function stbi__process_frame_header (line 3264) | static int stbi__process_frame_header(stbi__jpeg *z, int scan)
  function stbi__decode_jpeg_header (line 3365) | static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
  function stbi_uc (line 3389) | static stbi_uc stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)
  function stbi__decode_jpeg_image (line 3412) | static int stbi__decode_jpeg_image(stbi__jpeg *j)
  type stbi_uc (line 3451) | typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_u...
  function stbi_uc (line 3456) | static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *...
  function stbi_uc (line 3465) | static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, s...
  function stbi_uc (line 3475) | static stbi_uc*  stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, ...
  function stbi_uc (line 3505) | static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, ...
  function stbi_uc (line 3530) | static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_n...
  function stbi_uc (line 3646) | static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_nea...
  function stbi__YCbCr_to_RGB_row (line 3660) | static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const...
  function stbi__YCbCr_to_RGB_simd (line 3686) | static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi...
  function stbi__setup_jpeg (line 3821) | static void stbi__setup_jpeg(stbi__jpeg *j)
  function stbi__cleanup_jpeg (line 3843) | static void stbi__cleanup_jpeg(stbi__jpeg *j)
  type stbi__resample (line 3848) | typedef struct
  function stbi_uc (line 3859) | static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y)
  function stbi_uc (line 3865) | static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, i...
  function stbi__jpeg_test (line 4042) | static int stbi__jpeg_test(stbi__context *s)
  function stbi__jpeg_info_raw (line 4056) | static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
  function stbi__jpeg_info (line 4068) | static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
  type stbi__zhuffman (line 4097) | typedef struct
  function stbi_inline (line 4107) | stbi_inline static int stbi__bitreverse16(int n)
  function stbi_inline (line 4116) | stbi_inline static int stbi__bit_reverse(int v, int bits)
  function stbi__zbuild_huffman (line 4124) | static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizeli...
  type stbi__zbuf (line 4177) | typedef struct
  function stbi_inline (line 4192) | stbi_inline static int stbi__zeof(stbi__zbuf *z)
  function stbi_inline (line 4197) | stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z)
  function stbi__fill_bits (line 4202) | static void stbi__fill_bits(stbi__zbuf *z)
  function stbi__zreceive (line 4214) | int stbi__zreceive(stbi__zbuf *z, int n)
  function stbi__zhuffman_decode_slowpath (line 4224) | static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z)
  function stbi_inline (line 4243) | stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffm...
  function stbi__zexpand (line 4273) | static int stbi__zexpand(stbi__zbuf *z, char *zout, int n)  // need to m...
  function stbi__parse_huffman_block (line 4309) | static int stbi__parse_huffman_block(stbi__zbuf *a)
  function stbi__compute_huffman_codes (line 4359) | static int stbi__compute_huffman_codes(stbi__zbuf *a)
  function stbi__parse_uncompressed_block (line 4409) | static int stbi__parse_uncompressed_block(stbi__zbuf *a)
  function stbi__parse_zlib_header (line 4438) | static int stbi__parse_zlib_header(stbi__zbuf *a)
  function stbi__parse_zlib (line 4481) | static int stbi__parse_zlib(stbi__zbuf *a, int parse_header)
  function stbi__do_zlib (line 4510) | static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, i...
  function STBIDEF (line 4520) | STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int ...
  function STBIDEF (line 4536) | STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *...
  function STBIDEF (line 4541) | STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *b...
  function STBIDEF (line 4557) | STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const ...
  function STBIDEF (line 4568) | STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int l...
  function STBIDEF (line 4584) | STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, co...
  type stbi__pngchunk (line 4607) | typedef struct
  function stbi__pngchunk (line 4613) | static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)
  function stbi__check_png_header (line 4621) | static int stbi__check_png_header(stbi__context *s)
  type stbi__png (line 4630) | typedef struct
  function stbi__paeth (line 4657) | static int stbi__paeth(int a, int b, int c)
  function stbi__create_png_alpha_expand8 (line 4675) | static void stbi__create_png_alpha_expand8(stbi_uc *dest, stbi_uc *src, ...
  function stbi__create_png_image_raw (line 4696) | static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__...
  function stbi__create_png_image (line 4861) | static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stb...
  function stbi__compute_transparency (line 4906) | static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int o...
  function stbi__compute_transparency16 (line 4931) | static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3]...
  function stbi__expand_png_palette (line 4956) | static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int ...
  function STBIDEF (line 4996) | STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpr...
  function STBIDEF (line 5001) | STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_conv...
  function STBIDEF (line 5013) | STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_shou...
  function STBIDEF (line 5019) | STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_shou...
  function stbi__de_iphone (line 5033) | static void stbi__de_iphone(stbi__png *z)
  function stbi__parse_png_file (line 5078) | static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
  function stbi__png_test (line 5302) | static int stbi__png_test(stbi__context *s)
  function stbi__png_info_raw (line 5310) | static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp)
  function stbi__png_info (line 5322) | static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__png_is16 (line 5329) | static int stbi__png_is16(stbi__context *s)
  function stbi__bmp_test_raw (line 5346) | static int stbi__bmp_test_raw(stbi__context *s)
  function stbi__bmp_test (line 5361) | static int stbi__bmp_test(stbi__context *s)
  function stbi__high_bit (line 5370) | static int stbi__high_bit(unsigned int z)
  function stbi__bitcount (line 5382) | static int stbi__bitcount(unsigned int a)
  function stbi__shiftsigned (line 5395) | static int stbi__shiftsigned(unsigned int v, int shift, int bits)
  type stbi__bmp_data (line 5415) | typedef struct
  function stbi__bmp_set_mask_defaults (line 5422) | static int stbi__bmp_set_mask_defaults(stbi__bmp_data *info, int compress)
  function stbi__tga_get_comp (line 5739) | static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_r...
  function stbi__tga_info (line 5755) | static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__tga_test (line 5820) | static int stbi__tga_test(stbi__context *s)
  function stbi__tga_read_rgb16 (line 5852) | static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out)
  function stbi__psd_test (line 6081) | static int stbi__psd_test(stbi__context *s)
  function stbi__psd_decode_rle (line 6088) | static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelC...
  function stbi__pic_is4 (line 6336) | static int stbi__pic_is4(stbi__context *s,const char *str)
  function stbi__pic_test_core (line 6346) | static int stbi__pic_test_core(stbi__context *s)
  type stbi__pic_packet (line 6362) | typedef struct
  function stbi_uc (line 6367) | static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest)
  function stbi__copyval (line 6381) | static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src)
  function stbi_uc (line 6390) | static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int heigh...
  function stbi__pic_test (line 6541) | static int stbi__pic_test(stbi__context *s)
  type stbi__gif_lzw (line 6553) | typedef struct
  type stbi__gif (line 6560) | typedef struct
  function stbi__gif_test_raw (line 6580) | static int stbi__gif_test_raw(stbi__context *s)
  function stbi__gif_test (line 6590) | static int stbi__gif_test(stbi__context *s)
  function stbi__gif_parse_colortable (line 6597) | static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256...
  function stbi__gif_header (line 6608) | static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, i...
  function stbi__gif_info_raw (line 6639) | static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
  function stbi__out_gif_code (line 6654) | static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
  function stbi_uc (line 6691) | static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
  function stbi_uc (line 6778) | static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int ...
  function stbi__gif_info (line 7077) | static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__hdr_test_core (line 7087) | static int stbi__hdr_test_core(stbi__context *s, const char *signature)
  function stbi__hdr_test (line 7097) | static int stbi__hdr_test(stbi__context* s)
  function stbi__hdr_convert (line 7131) | static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp)
  function stbi__hdr_info (line 7289) | static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__bmp_info (line 7335) | static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__psd_info (line 7359) | static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__psd_is16 (line 7394) | static int stbi__psd_is16(stbi__context *s)
  function stbi__pic_info (line 7423) | static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__pnm_test (line 7494) | static int      stbi__pnm_test(stbi__context *s)
  function stbi__pnm_isspace (line 7543) | static int      stbi__pnm_isspace(char c)
  function stbi__pnm_skip_whitespace (line 7548) | static void     stbi__pnm_skip_whitespace(stbi__context *s, char *c)
  function stbi__pnm_isdigit (line 7562) | static int      stbi__pnm_isdigit(char c)
  function stbi__pnm_getinteger (line 7567) | static int      stbi__pnm_getinteger(stbi__context *s, char *c)
  function stbi__pnm_info (line 7581) | static int      stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
  function stbi__pnm_is16 (line 7624) | static int stbi__pnm_is16(stbi__context *s)
  function stbi__info_main (line 7632) | static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
  function stbi__is_16_main (line 7674) | static int stbi__is_16_main(stbi__context *s)
  function STBIDEF (line 7691) | STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp)
  function STBIDEF (line 7701) | STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
  function STBIDEF (line 7712) | STBIDEF int stbi_is_16_bit(char const *filename)
  function STBIDEF (line 7722) | STBIDEF int stbi_is_16_bit_from_file(FILE *f)
  function STBIDEF (line 7734) | STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x...
  function STBIDEF (line 7741) | STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *u...
  function STBIDEF (line 7748) | STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len)
  function STBIDEF (line 7755) | STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, vo...

FILE: stb_image_resize2.h
  type stbir_uint8 (line 393) | typedef unsigned char    stbir_uint8;
  type stbir_uint16 (line 394) | typedef unsigned short   stbir_uint16;
  type stbir_uint32 (line 395) | typedef unsigned int     stbir_uint32;
  type stbir_uint64 (line 396) | typedef unsigned __int64 stbir_uint64;
  type stbir_uint8 (line 399) | typedef uint8_t  stbir_uint8;
  type stbir_uint16 (line 400) | typedef uint16_t stbir_uint16;
  type stbir_uint32 (line 401) | typedef uint32_t stbir_uint32;
  type stbir_uint64 (line 402) | typedef uint64_t stbir_uint64;
  type stbir_pixel_layout (line 435) | typedef enum
  type stbir_edge (line 495) | typedef enum
  type stbir_filter (line 503) | typedef enum
  type stbir_datatype (line 515) | typedef enum
  type stbir__info (line 572) | typedef struct stbir__info stbir__info;
  type STBIR_RESIZE (line 574) | typedef struct STBIR_RESIZE  // use the stbir_resize_init and stbir_over...
  type STBIR_PROFILE_INFO (line 753) | typedef struct STBIR_PROFILE_INFO
  type stbir_internal_pixel_layout (line 861) | typedef enum
  type stbir__contributors (line 910) | typedef struct
  type stbir__filter_extent_info (line 916) | typedef struct
  type stbir__span (line 923) | typedef struct
  type stbir__scale_info (line 930) | typedef struct stbir__scale_info
  type stbir__sampler (line 941) | typedef struct
  type stbir__extents (line 967) | typedef struct
  type stbir__per_split_info (line 974) | typedef struct
  type stbir__info (line 1010) | struct stbir__info
  function stbir__inline (line 1077) | static stbir__inline int stbir__min(int a, int b)
  function stbir__inline (line 1082) | static stbir__inline int stbir__max(int a, int b)
  type stbir__FP32 (line 1114) | typedef union
  function stbir__inline (line 1138) | static stbir__inline stbir_uint8 stbir__linear_to_srgb_uchar(float in)
  function stbir__simdf_pack_to_8words (line 1482) | static STBIR__SIMDI_CONST(stbir__s16_32768, ((32768<<16)|32768));
  function stbir__inline (line 1679) | static stbir__inline float stbir_simd_floorf(float x)  // martins floorf
  function stbir__inline (line 1696) | static stbir__inline float stbir_simd_ceilf(float x)  // martins ceilf
  function stbir__inline (line 1821) | static stbir__inline uint8x16x2_t stbir_make16x2(float32x4_t rega,float3...
  function stbir__inline (line 1849) | static stbir__inline uint8x8x2_t stbir_make8x2(float32x4_t reg)
  function stbir__inline (line 1940) | static stbir__inline float stbir_simd_floorf(float x)
  function stbir__inline (line 1958) | static stbir__inline float stbir_simd_ceilf(float x)
  type stbir__f32x4 (line 2120) | typedef float stbir__f32x4 __attribute__((__vector_size__(16), __aligned...
  function stbir__inline (line 2130) | static stbir__inline float stbir_simd_floorf(float x)
  function stbir__inline (line 2139) | static stbir__inline float stbir_simd_ceilf(float x)
  type __int16 (line 2219) | typedef __int16 stbir__FP16;
  type float16_t (line 2221) | typedef float16_t stbir__FP16;
  type stbir__FP16 (line 2226) | typedef union stbir__FP16
  function stbir__inline (line 2237) | static stbir__inline float stbir__half_to_float( stbir__FP16 h )
  function stbir__inline (line 2251) | static stbir__inline stbir__FP16 stbir__float_to_half(float val)
  function stbir__inline (line 2301) | static stbir__inline void stbir__half_to_float_SIMD(float * output, stbi...
  function stbir__inline (line 2306) | static stbir__inline void stbir__float_to_half_SIMD(stbir__FP16 * output...
  function stbir__inline (line 2311) | static stbir__inline float stbir__half_to_float( stbir__FP16 h )
  function stbir__inline (line 2316) | static stbir__inline stbir__FP16 stbir__float_to_half( float f )
  function stbir__inline (line 2326) | stbir__inline static void stbir__half_to_float_SIMD(float * output, void...
  function stbir__inline (line 2380) | stbir__inline static void stbir__float_to_half_SIMD(void * output, float...
  function stbir__inline (line 2462) | static stbir__inline void stbir__half_to_float_SIMD(float * output, stbi...
  function stbir__inline (line 2470) | static stbir__inline void stbir__float_to_half_SIMD(stbir__FP16 * output...
  function stbir__inline (line 2478) | static stbir__inline float stbir__half_to_float( stbir__FP16 h )
  function stbir__inline (line 2483) | static stbir__inline stbir__FP16 stbir__float_to_half( float f )
  function stbir__inline (line 2490) | static stbir__inline void stbir__half_to_float_SIMD(float * output, stbi...
  function stbir__inline (line 2497) | static stbir__inline void stbir__float_to_half_SIMD(stbir__FP16 * output...
  function stbir__inline (line 2504) | static stbir__inline float stbir__half_to_float( stbir__FP16 h )
  function stbir__inline (line 2509) | static stbir__inline stbir__FP16 stbir__float_to_half( float f )
  function stbir__inline (line 2516) | static stbir__inline void stbir__half_to_float_SIMD(float * output, stbi...
  function stbir__inline (line 2523) | static stbir__inline void stbir__float_to_half_SIMD(stbir__FP16 * output...
  type stbir__simdi_u32 (line 2557) | typedef union stbir__simdi_u32
  function stbir_simd_memcpy (line 2592) | static void stbir_simd_memcpy( void * dest, void const * src, size_t byt...
  function stbir_overlapping_memcpy (line 2685) | static void stbir_overlapping_memcpy( void * dest, void const * src, siz...
  function stbir__inline (line 2740) | static stbir__inline stbir_uint64 STBIR_PROFILE_FUNC()
  function stbir__inline (line 2757) | static stbir__inline stbir_uint64 STBIR_PROFILE_FUNC()
  function stbir_overlapping_memcpy (line 2840) | static void stbir_overlapping_memcpy( void * dest, void const * src, siz...
  function stbir__filter_trapezoid (line 2890) | static float stbir__filter_trapezoid(float x, float scale, void * user_d...
  function stbir__support_trapezoid (line 2911) | static float stbir__support_trapezoid(float scale, void * user_data)
  function stbir__filter_triangle (line 2917) | static float stbir__filter_triangle(float x, float s, void * user_data)
  function stbir__filter_point (line 2930) | static float stbir__filter_point(float x, float s, void * user_data)
  function stbir__filter_cubic (line 2939) | static float stbir__filter_cubic(float x, float s, void * user_data)
  function stbir__filter_catmullrom (line 2954) | static float stbir__filter_catmullrom(float x, float s, void * user_data)
  function stbir__filter_mitchell (line 2969) | static float stbir__filter_mitchell(float x, float s, void * user_data)
  function stbir__support_zeropoint5 (line 2984) | static float stbir__support_zeropoint5(float s, void * user_data)
  function stbir__support_one (line 2991) | static float stbir__support_one(float s, void * user_data)
  function stbir__support_two (line 2998) | static float stbir__support_two(float s, void * user_data)
  function stbir__get_filter_pixel_width (line 3007) | static int stbir__get_filter_pixel_width(stbir__support_callback * suppo...
  function stbir__get_coefficient_width (line 3019) | static int stbir__get_coefficient_width(stbir__sampler * samp, int is_ga...
  function stbir__get_contributors (line 3038) | static int stbir__get_contributors(stbir__sampler * samp, int is_gather)
  function stbir__edge_zero_full (line 3046) | static int stbir__edge_zero_full( int n, int max )
  function stbir__edge_clamp_full (line 3053) | static int stbir__edge_clamp_full( int n, int max )
  function stbir__edge_reflect_full (line 3064) | static int stbir__edge_reflect_full( int n, int max )
  function stbir__edge_wrap_full (line 3086) | static int stbir__edge_wrap_full( int n, int max )
  function stbir__inline (line 3110) | stbir__inline static int stbir__edge_wrap(stbir_edge edge, int n, int max)
  function stbir__get_extents (line 3121) | static void stbir__get_extents( stbir__sampler * samp, stbir__extents * ...
  function stbir__calculate_in_pixel_range (line 3293) | static void stbir__calculate_in_pixel_range( int * first_pixel, int * la...
  function stbir__calculate_coefficients_for_gather_upsample (line 3318) | static void stbir__calculate_coefficients_for_gather_upsample( float out...
  function stbir__insert_coeff (line 3380) | static void stbir__insert_coeff( stbir__contributors * contribs, float *...
  function stbir__calculate_out_pixel_range (line 3422) | static void stbir__calculate_out_pixel_range( int * first_pixel, int * l...
  function stbir__calculate_coefficients_for_gather_downsample (line 3439) | static void stbir__calculate_coefficients_for_gather_downsample( int sta...
  function stbir__cleanup_gathered_coefficients (line 3523) | static void stbir__cleanup_gathered_coefficients( stbir_edge edge, stbir...
  function stbir__pack_coefficients (line 3696) | static int stbir__pack_coefficients( int num_contributors, stbir__contri...
  function STBIR_NO_UNROLL_LOOP_START (line 3839) | STBIR_NO_UNROLL_LOOP_START
  function stbir__calculate_filters (line 3931) | static void stbir__calculate_filters( stbir__sampler * samp, stbir__samp...
  function stbir__fancy_alpha_weight_4ch (line 4138) | static void stbir__fancy_alpha_weight_4ch( float * out_buffer, int width...
  function stbir__fancy_alpha_weight_2ch (line 4234) | static void stbir__fancy_alpha_weight_2ch( float * out_buffer, int width...
  function stbir__fancy_alpha_unweight_4ch (line 4304) | static void stbir__fancy_alpha_unweight_4ch( float * encode_buffer, int ...
  function stbir__fancy_alpha_unweight_2ch (line 4354) | static void stbir__fancy_alpha_unweight_2ch( float * encode_buffer, int ...
  function stbir__simple_alpha_weight_4ch (line 4372) | static void stbir__simple_alpha_weight_4ch( float * decode_buffer, int w...
  function stbir__simple_alpha_weight_2ch (line 4428) | static void stbir__simple_alpha_weight_2ch( float * decode_buffer, int w...
  function stbir__simple_alpha_unweight_4ch (line 4463) | static void stbir__simple_alpha_unweight_4ch( float * encode_buffer, int...
  function stbir__simple_alpha_unweight_2ch (line 4496) | static void stbir__simple_alpha_unweight_2ch( float * encode_buffer, int...
  function stbir__simple_flip_3ch (line 4511) | static void stbir__simple_flip_3ch( float * decode_buffer, int width_tim...
  function stbir__decode_scanline (line 4610) | static void stbir__decode_scanline(stbir__info const * stbir_info, int n...
  function stbir__encode_scanline (line 6184) | static void stbir__encode_scanline( stbir__info const * stbir_info, void...
  function stbir__resample_horizontal_gather (line 6236) | static void stbir__resample_horizontal_gather(stbir__info const * stbir_...
  function stbir__resample_vertical_gather (line 6248) | static void stbir__resample_vertical_gather(stbir__info const * stbir_in...
  function stbir__decode_and_resample_for_vertical_gather_loop (line 6289) | static void stbir__decode_and_resample_for_vertical_gather_loop(stbir__i...
  function stbir__vertical_gather_loop (line 6310) | static void stbir__vertical_gather_loop( stbir__info const * stbir_info,...
  function stbir__encode_first_scanline_from_scatter (line 6374) | static void stbir__encode_first_scanline_from_scatter(stbir__info const ...
  function stbir__horizontal_resample_and_encode_first_scanline_from_scatter (line 6391) | static void stbir__horizontal_resample_and_encode_first_scanline_from_sc...
  function stbir__resample_vertical_scatter (line 6412) | static void stbir__resample_vertical_scatter(stbir__info const * stbir_i...
  function stbir__vertical_scatter_loop (line 6444) | static void stbir__vertical_scatter_loop( stbir__info const * stbir_info...
  function stbir__set_sampler (line 6573) | static void stbir__set_sampler(stbir__sampler * samp, stbir_filter filte...
  function stbir__get_conservative_extents (line 6655) | static void stbir__get_conservative_extents( stbir__sampler * samp, stbi...
  function stbir__get_split_info (line 6747) | static void stbir__get_split_info( stbir__per_split_info* split_info, in...
  function stbir__free_internal_mem (line 6817) | static void stbir__free_internal_mem( stbir__info *info )
  function stbir__get_max_split (line 6868) | static int stbir__get_max_split( int splits, int height )
  type STBIR__V_FIRST_INFO (line 6947) | typedef struct STBIR__V_FIRST_INFO
  function stbir__should_do_vertical_first (line 6985) | static int stbir__should_do_vertical_first( float weights_table[STBIR_RE...
  function stbir__info (line 7048) | static stbir__info * stbir__alloc_internal_mem_and_build_samplers( stbir...
  function stbir__perform_resize (line 7380) | static int stbir__perform_resize( stbir__info const * info, int split_st...
  function stbir__update_info_from_resize (line 7396) | static void stbir__update_info_from_resize( stbir__info * info, STBIR_RE...
  function stbir__clip (line 7545) | static void stbir__clip( int * outx, int * outsubw, int outw, double * u...
  function stbir__double_to_rational (line 7571) | static int stbir__double_to_rational(double f, stbir_uint32 limit, stbir...
  function stbir__calculate_region_transform (line 7648) | static int stbir__calculate_region_transform( stbir__scale_info * scale_...
  function stbir__init_and_set_layout (line 7698) | static void stbir__init_and_set_layout( STBIR_RESIZE * resize, stbir_pix...
  function STBIRDEF (line 7720) | STBIRDEF void stbir_resize_init( STBIR_RESIZE * resize,
  function STBIRDEF (line 7739) | STBIRDEF void stbir_set_datatypes( STBIR_RESIZE * resize, stbir_datatype...
  function STBIRDEF (line 7747) | STBIRDEF void stbir_set_pixel_callbacks( STBIR_RESIZE * resize, stbir_in...
  function STBIRDEF (line 7759) | STBIRDEF void stbir_set_user_data( STBIR_RESIZE * resize, void * user_da...
  function STBIRDEF (line 7766) | STBIRDEF void stbir_set_buffer_ptrs( STBIR_RESIZE * resize, const void *...
  function STBIRDEF (line 7777) | STBIRDEF int stbir_set_edgemodes( STBIR_RESIZE * resize, stbir_edge hori...
  function STBIRDEF (line 7785) | STBIRDEF int stbir_set_filters( STBIR_RESIZE * resize, stbir_filter hori...
  function STBIRDEF (line 7793) | STBIRDEF int stbir_set_filter_callbacks( STBIR_RESIZE * resize, stbir__k...
  function STBIRDEF (line 7801) | STBIRDEF int stbir_set_pixel_layouts( STBIR_RESIZE * resize, stbir_pixel...
  function STBIRDEF (line 7810) | STBIRDEF int stbir_set_non_pm_alpha_speed_over_quality( STBIR_RESIZE * r...
  function STBIRDEF (line 7817) | STBIRDEF int stbir_set_input_subrect( STBIR_RESIZE * resize, double s0, ...
  function STBIRDEF (line 7835) | STBIRDEF int stbir_set_output_pixel_subrect( STBIR_RESIZE * resize, int ...
  function STBIRDEF (line 7850) | STBIRDEF int stbir_set_pixel_subrect( STBIR_RESIZE * resize, int subx, i...
  function stbir__perform_build (line 7876) | static int stbir__perform_build( STBIR_RESIZE * resize, int splits )
  function STBIRDEF (line 7949) | STBIRDEF void stbir_free_samplers( STBIR_RESIZE * resize )
  function STBIRDEF (line 7959) | STBIRDEF int stbir_build_samplers_with_splits( STBIR_RESIZE * resize, in...
  function STBIRDEF (line 7975) | STBIRDEF int stbir_build_samplers( STBIR_RESIZE * resize )
  function STBIRDEF (line 7980) | STBIRDEF int stbir_resize_extended( STBIR_RESIZE * resize )
  function STBIRDEF (line 8024) | STBIRDEF int stbir_resize_extended_split( STBIR_RESIZE * resize, int spl...
  function STBIRDEF (line 8139) | STBIRDEF float * stbir_resize_float_linear( const float *input_pixels , ...
  function STBIRDEF (line 8149) | STBIRDEF void * stbir_resize( const void *input_pixels , int input_w , i...
  function STBIRDEF (line 8161) | STBIRDEF void stbir_resize_build_profile_info( STBIR_PROFILE_INFO * info...
  function STBIRDEF (line 8179) | STBIRDEF void stbir_resize_split_profile_info( STBIR_PROFILE_INFO * info...
  function STBIRDEF (line 8219) | STBIRDEF void stbir_resize_extended_profile_info( STBIR_PROFILE_INFO * i...
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 8360) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8376) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8437) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8456) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8493) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 8573) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8589) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8649) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8688) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8729) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 8860) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 8878) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 8962) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9054) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9127) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9143) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9201) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9220) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9242) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9259) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9330) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9346) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9403) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9425) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9444) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9515) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9531) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9600) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9616) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9694) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9710) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9807) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 9832) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 9852) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 10083) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_NO_UNROLL_LOOP_START (line 10239) | STBIR_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10332) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10345) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10358) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10371) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10384) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10398) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10413) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10428) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10442) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10457) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10473) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10488) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10503) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10525) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10548) | STBIR_SIMD_NO_UNROLL_LOOP_START
  function STBIR_SIMD_NO_UNROLL_LOOP_START (line 10573) | STBIR_SIMD_NO_UNROLL_LOOP_START

FILE: stb_image_resize_test/dotimings.c
  type U32 (line 19) | typedef unsigned int U32;
  type U64 (line 20) | typedef unsigned long long U64;
  function get_milliseconds (line 23) | static int get_milliseconds()
  function file_write (line 56) | static int file_write( const char *filename, void * buffer, size_t size )
  function int64 (line 65) | int64 nresize( void * o, int ox, int oy, int op, void * i, int ix, int i...
  function main (line 107) | int main( int argc, char ** argv )

FILE: stb_image_resize_test/old_image_resize.h
  type stbir_uint8 (line 187) | typedef unsigned char  stbir_uint8;
  type stbir_uint16 (line 188) | typedef unsigned short stbir_uint16;
  type stbir_uint32 (line 189) | typedef unsigned int   stbir_uint32;
  type stbir_uint64 (line 190) | typedef unsigned __int64   stbir_uint64;
  type stbir_uint8 (line 193) | typedef uint8_t  stbir_uint8;
  type stbir_uint16 (line 194) | typedef uint16_t stbir_uint16;
  type stbir_uint32 (line 195) | typedef uint32_t stbir_uint32;
  type stbir_uint64 (line 196) | typedef uint64_t stbir_uint64;
  type stbir_edge (line 261) | typedef enum
  type stbir_filter (line 290) | typedef enum
  type stbir_colorspace (line 300) | typedef enum
  type stbir_datatype (line 343) | typedef enum
  function stbir__inline (line 437) | static stbir__inline stbir_uint64 STBIR_PROFILE_FUNC()
  function stbir__inline (line 454) | static stbir__inline stbir_uint64 STBIR_PROFILE_FUNC()
  type stbir__filter_info (line 542) | typedef struct
  type stbir__contributors (line 550) | typedef struct
  type ostbir__info (line 556) | typedef struct
  function stbir__inline (line 631) | static stbir__inline int stbir__min(int a, int b)
  function stbir__inline (line 636) | static stbir__inline float stbir__saturate(float x)
  function stbir__inline (line 648) | static stbir__inline stbir_uint8 stbir__saturate8(int x)
  function stbir__inline (line 659) | static stbir__inline stbir_uint16 stbir__saturate16(int x)
  function stbir__srgb_to_linear (line 698) | static float stbir__srgb_to_linear(float f)
  function stbir__linear_to_srgb (line 706) | static float stbir__linear_to_srgb(float f)
  type stbir__FP32 (line 717) | typedef union
  function stbir_uint8 (line 739) | static stbir_uint8 stbir__linear_to_srgb_uchar(float in)
  function stbir_uint8 (line 803) | static stbir_uint8 stbir__linear_to_srgb_uchar(float f)
  function stbir__filter_trapezoid (line 823) | static float stbir__filter_trapezoid(float x, float scale)
  function stbir__support_trapezoid (line 843) | static float stbir__support_trapezoid(float scale)
  function stbir__filter_triangle (line 849) | static float stbir__filter_triangle(float x, float s)
  function stbir__filter_cubic (line 861) | static float stbir__filter_cubic(float x, float s)
  function stbir__filter_catmullrom (line 875) | static float stbir__filter_catmullrom(float x, float s)
  function stbir__filter_mitchell (line 889) | static float stbir__filter_mitchell(float x, float s)
  function stbir__support_zero (line 903) | static float stbir__support_zero(float s)
  function stbir__support_one (line 909) | static float stbir__support_one(float s)
  function stbir__support_two (line 915) | static float stbir__support_two(float s)
  function stbir__inline (line 930) | stbir__inline static int stbir__use_upsampling(float ratio)
  function stbir__inline (line 935) | stbir__inline static int stbir__use_width_upsampling(ostbir__info* stbir...
  function stbir__inline (line 940) | stbir__inline static int stbir__use_height_upsampling(ostbir__info* stbi...
  function stbir__get_filter_pixel_width (line 947) | static int stbir__get_filter_pixel_width(stbir_filter filter, float scale)
  function stbir__get_filter_pixel_margin (line 960) | static int stbir__get_filter_pixel_margin(stbir_filter filter, float scale)
  function stbir__get_coefficient_width (line 965) | static int stbir__get_coefficient_width(stbir_filter filter, float scale)
  function stbir__get_contributors (line 973) | static int stbir__get_contributors(float scale, stbir_filter filter, int...
  function stbir__get_total_horizontal_coefficients (line 981) | static int stbir__get_total_horizontal_coefficients(ostbir__info* info)
  function stbir__get_total_vertical_coefficients (line 987) | static int stbir__get_total_vertical_coefficients(ostbir__info* info)
  function stbir__contributors (line 993) | static stbir__contributors* stbir__get_contributor(stbir__contributors* ...
  function stbir__edge_wrap_slow (line 1006) | static int stbir__edge_wrap_slow(stbir_edge edge, int n, int max)
  function stbir__inline (line 1064) | stbir__inline static int stbir__edge_wrap(stbir_edge edge, int n, int max)
  function stbir__calculate_sample_range_upsample (line 1073) | static void stbir__calculate_sample_range_upsample(int n, float out_filt...
  function stbir__calculate_sample_range_downsample (line 1088) | static void stbir__calculate_sample_range_downsample(int n, float in_pix...
  function stbir__calculate_coefficients_upsample (line 1102) | static void stbir__calculate_coefficients_upsample(stbir_filter filter, ...
  function stbir__calculate_coefficients_downsample (line 1152) | static void stbir__calculate_coefficients_downsample(stbir_filter filter...
  function stbir__normalize_downsample_coefficients (line 1182) | static void stbir__normalize_downsample_coefficients(stbir__contributors...
  function stbir__calculate_filters (line 1259) | static void stbir__calculate_filters(stbir__contributors* contributors, ...
  function stbir__decode_scanline (line 1308) | static void stbir__decode_scanline(ostbir__info* stbir_info, int n)
  function stbir__resample_horizontal_upsample (line 1512) | static void stbir__resample_horizontal_upsample(ostbir__info* stbir_info...
  function stbir__resample_horizontal_downsample (line 1597) | static void stbir__resample_horizontal_downsample(ostbir__info* stbir_in...
  function stbir__decode_and_resample_upsample (line 1729) | static void stbir__decode_and_resample_upsample(ostbir__info* stbir_info...
  function stbir__decode_and_resample_downsample (line 1743) | static void stbir__decode_and_resample_downsample(ostbir__info* stbir_in...
  function stbir__encode_scanline (line 1767) | static void stbir__encode_scanline(ostbir__info* stbir_info, int num_pix...
  function stbir__resample_vertical_upsample (line 1953) | static void stbir__resample_vertical_upsample(ostbir__info* stbir_info, ...
  function stbir__resample_vertical_downsample (line 2073) | static void stbir__resample_vertical_downsample(ostbir__info* stbir_info...
  function stbir__buffer_loop_upsample (line 2155) | static void stbir__buffer_loop_upsample(ostbir__info* stbir_info)
  function stbir__empty_ring_buffer (line 2208) | static void stbir__empty_ring_buffer(ostbir__info* stbir_info, int first...
  function stbir__buffer_loop_downsample (line 2253) | static void stbir__buffer_loop_downsample(ostbir__info* stbir_info)
  function stbir__setup (line 2294) | static void stbir__setup(ostbir__info *info, int input_w, int input_h, i...
  function stbir__calculate_transform (line 2303) | static void stbir__calculate_transform(ostbir__info *info, float s0, flo...
  function stbir__choose_filter (line 2327) | static void stbir__choose_filter(ostbir__info *info, stbir_filter h_filt...
  function stbir_uint32 (line 2337) | static stbir_uint32 stbir__calculate_memory(ostbir__info *info)
  function stbir__resize_allocated (line 2378) | static int stbir__resize_allocated(ostbir__info *info,
  function stbir__resize_arbitrary (line 2526) | static int stbir__resize_arbitrary(
  function STBIRDEF (line 2566) | STBIRDEF int stbir_resize_uint8(     const unsigned char *input_pixels ,...
  function STBIRDEF (line 2576) | STBIRDEF int stbir_resize_float(     const float *input_pixels , int inp...
  function STBIRDEF (line 2586) | STBIRDEF int stbir_resize_uint8_srgb(const unsigned char *input_pixels ,...
  function STBIRDEF (line 2596) | STBIRDEF int stbir_resize_uint8_srgb_edgemode(const unsigned char *input...
  function STBIRDEF (line 2607) | STBIRDEF int stbir_resize_uint8_generic( const unsigned char *input_pixe...
  function STBIRDEF (line 2619) | STBIRDEF int stbir_resize_uint16_generic(const stbir_uint16 *input_pixel...
  function STBIRDEF (line 2632) | STBIRDEF int stbir_resize_float_generic( const float *input_pixels      ...
  function STBIRDEF (line 2645) | STBIRDEF int stbir_resize(         const void *input_pixels , int input_...
  function STBIRDEF (line 2660) | STBIRDEF int stbir_resize_subpixel(const void *input_pixels , int input_...
  function STBIRDEF (line 2681) | STBIRDEF int stbir_resize_region(  const void *input_pixels , int input_...

FILE: stb_image_resize_test/oldir.c
  function oresize (line 26) | void oresize( void * o, int ox, int oy, int op, void * i, int ix, int iy...

FILE: stb_image_resize_test/stbirtest.c
  function uint64 (line 46) | static inline uint64 __cycles()
  function uint64 (line 63) | static inline uint64 __cycles()
  function wfree (line 129) | void wfree(void * ptr)
  function wfree (line 194) | void wfree(void * ptr)
  function do_acc_zones (line 277) | static void do_acc_zones( STBIR_PROFILE_INFO * profile )
  function DWORD (line 303) | static DWORD resize_shim( LPVOID p )
  function nresize (line 326) | void nresize( void * o, int ox, int oy, int op, void * i, int ix, int iy...
  function isprime (line 489) | static int isprime( int v )
  function getprime (line 512) | static int getprime( int v )

FILE: stb_image_resize_test/vf_train.c
  type fileinfo (line 34) | typedef struct fileinfo
  function use_timing_file (line 59) | static int use_timing_file( char const * filename, int index )
  function vert_first (line 91) | static int vert_first( float weights_table[STBIR_RESIZE_CLASSIFICATIONS]...
  function alloc_bitmap (line 105) | static void alloc_bitmap()
  function build_bitmap (line 149) | static void build_bitmap( float weights[STBIR_RESIZE_CLASSIFICATIONS][4]...
  function build_comp_bitmap (line 230) | static void build_comp_bitmap( float weights[STBIR_RESIZE_CLASSIFICATION...
  function write_bitmap (line 304) | static void write_bitmap()
  function calc_errors (line 310) | static void calc_errors( float weights_table[STBIR_RESIZE_CLASSIFICATION...
  function expand_to_floats (line 384) | static void expand_to_floats( float * weights, int range )
  function print_weights (line 404) | static void print_weights( float weights[STBIR_RESIZE_CLASSIFICATIONS][4...
  function opt_channel (line 420) | static void opt_channel( float best_output_weights[STBIR_RESIZE_CLASSIFI...
  function print_struct (line 494) | static void print_struct( float weight[5][STBIR_RESIZE_CLASSIFICATIONS][...
  function DWORD (line 517) | static DWORD __stdcall retrain_shim( LPVOID p )
  function LRESULT (line 539) | static LRESULT WINAPI WindowProc( HWND   window,
  function SetHighDPI (line 730) | static void SetHighDPI(void)
  function draw_window (line 742) | static void draw_window()
  function retrain (line 805) | static void retrain()
  function info (line 828) | static void info()
  function current (line 859) | static void current( int do_win, int do_bitmap )
  function compare (line 892) | static void compare()
  function load_files (line 929) | static void load_files( char ** args, int count )
  function main (line 950) | int main( int argc, char ** argv )

FILE: stb_image_write.h
  function STBIWDEF (line 262) | STBIWDEF void stbi_flip_vertically_on_write(int flag)
  type stbi__write_context (line 267) | typedef struct
  function stbi__start_write_callbacks (line 276) | static void stbi__start_write_callbacks(stbi__write_context *s, stbi_wri...
  function stbi__stdio_write (line 284) | static void stbi__stdio_write(void *context, void *data, int size)
  function STBIWDEF (line 298) | STBIWDEF int stbiw_convert_wchar_to_utf8(char *buffer, size_t bufferlen,...
  function FILE (line 304) | static FILE *stbiw__fopen(char const *filename, char const *mode)
  function stbi__start_write_file (line 332) | static int stbi__start_write_file(stbi__write_context *s, const char *fi...
  function stbi__end_write_file (line 339) | static void stbi__end_write_file(stbi__write_context *s)
  type stbiw_uint32 (line 346) | typedef unsigned int stbiw_uint32;
  function stbiw__writefv (line 349) | static void stbiw__writefv(stbi__write_context *s, const char *fmt, va_l...
  function stbiw__writef (line 378) | static void stbiw__writef(stbi__write_context *s, const char *fmt, ...)
  function stbiw__write_flush (line 386) | static void stbiw__write_flush(stbi__write_context *s)
  function stbiw__putc (line 394) | static void stbiw__putc(stbi__write_context *s, unsigned char c)
  function stbiw__write1 (line 399) | static void stbiw__write1(stbi__write_context *s, unsigned char a)
  function stbiw__write3 (line 406) | static void stbiw__write3(stbi__write_context *s, unsigned char a, unsig...
  function stbiw__write_pixel (line 418) | static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int ...
  function stbiw__write_pixels (line 451) | static void stbiw__write_pixels(stbi__write_context *s, int rgb_dir, int...
  function stbiw__outfile (line 478) | static int stbiw__outfile(stbi__write_context *s, int rgb_dir, int vdir,...
  function stbi_write_bmp_core (line 492) | static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int...
  function STBIWDEF (line 512) | STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context...
  function STBIWDEF (line 520) | STBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp...
  function stbi_write_tga_core (line 532) | static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int...
  function STBIWDEF (line 611) | STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context...
  function STBIWDEF (line 619) | STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp...
  function stbiw__linear_to_rgbe (line 639) | static void stbiw__linear_to_rgbe(unsigned char *rgbe, float *linear)
  function stbiw__write_run_data (line 656) | static void stbiw__write_run_data(stbi__write_context *s, int length, un...
  function stbiw__write_dump_data (line 664) | static void stbiw__write_dump_data(stbi__write_context *s, int length, u...
  function stbiw__write_hdr_scanline (line 672) | static void stbiw__write_hdr_scanline(stbi__write_context *s, int width,...
  function stbi_write_hdr_core (line 761) | static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int...
  function STBIWDEF (line 787) | STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context...
  function STBIWDEF (line 794) | STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp...
  function stbiw__zlib_bitrev (line 849) | static int stbiw__zlib_bitrev(int code, int codebits)
  function stbiw__zlib_countm (line 859) | static unsigned int stbiw__zlib_countm(unsigned char *a, unsigned char *...
  function stbiw__zhash (line 867) | static unsigned int stbiw__zhash(unsigned char *data)
  function stbiw__crc32 (line 1024) | static unsigned int stbiw__crc32(unsigned char *buffer, int len)
  function stbiw__wpcrc (line 1077) | static void stbiw__wpcrc(unsigned char **data, int len)
  function stbiw__paeth (line 1083) | static unsigned char stbiw__paeth(int a, int b, int c)
  function stbiw__encode_png_line (line 1092) | static void stbiw__encode_png_line(unsigned char *pixels, int stride_byt...
  function STBIWDEF (line 1215) | STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp...
  function STBIWDEF (line 1231) | STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context...
  function stbiw__jpg_writeBits (line 1253) | static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, i...
  function stbiw__jpg_DCT (line 1270) | static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3...
  function stbiw__jpg_calcBits (line 1318) | static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) {
  function stbiw__jpg_processDU (line 1328) | static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int...
  function stbi_write_jpg_core (line 1398) | static int stbi_write_jpg_core(stbi__write_context *s, int width, int he...
  function STBIWDEF (line 1607) | STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context...
  function STBIWDEF (line 1616) | STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp...

FILE: stb_include.h
  type include_info (line 77) | typedef struct
  function include_info (line 85) | static include_info *stb_include_append_include(include_info *array, int...
  function stb_include_free_includes (line 95) | static void stb_include_free_includes(include_info *array, int len)
  function stb_include_isspace (line 103) | static int stb_include_isspace(int ch)
  function stb_include_find_includes (line 109) | static int stb_include_find_includes(char *text, include_info **plist)
  function stb_include_itoa (line 161) | static void stb_include_itoa(char str[9], int n)

FILE: stb_leakcheck.h
  type stb_leakcheck_malloc_info (line 25) | typedef struct malloc_info stb_leakcheck_malloc_info;
  type malloc_info (line 27) | struct malloc_info
  function stb_leakcheck_free (line 52) | void stb_leakcheck_free(void *ptr)
  function stblkck_internal_print (line 96) | static void stblkck_internal_print(const char *reason, stb_leakcheck_mal...
  function stb_leakcheck_dumpmem (line 118) | void stb_leakcheck_dumpmem(void)

FILE: stb_perlin.h
  function stb__perlin_lerp (line 179) | static float stb__perlin_lerp(float a, float b, float t)
  function stb__perlin_fastfloor (line 184) | static int stb__perlin_fastfloor(float a)
  function stb__perlin_grad (line 191) | static float stb__perlin_grad(int grad_idx, float x, float y, float z)
  function stb_perlin_noise3_internal (line 213) | float stb_perlin_noise3_internal(float x, float y, float z, int x_wrap, ...
  function stb_perlin_noise3 (line 265) | float stb_perlin_noise3(float x, float y, float z, int x_wrap, int y_wra...
  function stb_perlin_noise3_seed (line 270) | float stb_perlin_noise3_seed(float x, float y, float z, int x_wrap, int ...
  function stb_perlin_ridge_noise3 (line 275) | float stb_perlin_ridge_noise3(float x, float y, float z, float lacunarit...
  function stb_perlin_fbm_noise3 (line 295) | float stb_perlin_fbm_noise3(float x, float y, float z, float lacunarity,...
  function stb_perlin_turbulence_noise3 (line 310) | float stb_perlin_turbulence_noise3(float x, float y, float z, float lacu...
  function stb_perlin_noise3_wrap_nonpow2 (line 326) | float stb_perlin_noise3_wrap_nonpow2(float x, float y, float z, int x_wr...

FILE: stb_rect_pack.h
  type stbrp_context (line 81) | typedef struct stbrp_context stbrp_context;
  type stbrp_node (line 82) | typedef struct stbrp_node    stbrp_node;
  type stbrp_rect (line 83) | typedef struct stbrp_rect    stbrp_rect;
  type stbrp_coord (line 85) | typedef int            stbrp_coord;
  type stbrp_rect (line 115) | struct stbrp_rect
  type stbrp_node (line 175) | struct stbrp_node
  type stbrp_context (line 181) | struct stbrp_context
  function STBRP_DEF (line 229) | STBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)
  function STBRP_DEF (line 241) | STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int ...
  function STBRP_DEF (line 261) | STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int ...
  function stbrp__skyline_find_min_y (line 287) | static int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first...
  type stbrp__findresult (line 337) | typedef struct
  function stbrp__findresult (line 343) | static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, ...
  function stbrp__findresult (line 445) | static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *co...
  function rect_height_compare (line 524) | static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
  function rect_original_order (line 535) | static int STBRP__CDECL rect_original_order(const void *a, const void *b)
  function STBRP_DEF (line 542) | STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects...

FILE: stb_sprintf.h
  function STBSP__PUBLICDEF (line 274) | STBSP__PUBLICDEF void STB_SPRINTF_DECORATE(set_separators)(char pcomma, ...
  function stbsp__lead_sign (line 294) | static void stbsp__lead_sign(stbsp__uint32 fl, char *sign)
  function STBSP__ASAN (line 309) | static STBSP__ASAN stbsp__uint32 stbsp__strlen_limited(char const *s, st...
  function STBSP__PUBLICDEF (line 349) | STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(vsprintfcb)(STBSP_SPRINTFCB *c...
  function STBSP__PUBLICDEF (line 1376) | STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(sprintf)(char *buf, char const...
  type stbsp__context (line 1386) | typedef struct stbsp__context {
  function STBSP__PUBLICDEF (line 1430) | STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsnprintf )( char * buf, int ...
  function STBSP__PUBLICDEF (line 1460) | STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(snprintf)(char *buf, int count...
  function STBSP__PUBLICDEF (line 1472) | STBSP__PUBLICDEF int STB_SPRINTF_DECORATE(vsprintf)(char *buf, char cons...
  function stbsp__int32 (line 1491) | static stbsp__int32 stbsp__real_to_parts(stbsp__int64 *bits, stbsp__int3...
  function stbsp__raise_to_power10 (line 1638) | static void stbsp__raise_to_power10(double *ohi, double *olo, double d, ...
  function stbsp__int32 (line 1705) | static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32...

FILE: stb_textedit.h
  type StbUndoRecord (line 295) | typedef struct
  type StbUndoState (line 304) | typedef struct
  type STB_TexteditState (line 313) | typedef struct
  type StbTexteditRow (line 360) | typedef struct
  function stb_text_locate_coord (line 394) | static int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, floa...
  function stb_textedit_click (line 454) | static void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditSta...
  function stb_textedit_drag (line 472) | static void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditStat...
  type StbFindState (line 504) | typedef struct
  function stb_textedit_find_charpos (line 514) | static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_S...
  function stb_textedit_clamp (line 573) | static void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditSta...
  function stb_textedit_delete (line 587) | static void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditSt...
  function stb_textedit_delete_selection (line 595) | static void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_...
  function stb_textedit_sortselection (line 611) | static void stb_textedit_sortselection(STB_TexteditState *state)
  function stb_textedit_move_to_first (line 621) | static void stb_textedit_move_to_first(STB_TexteditState *state)
  function stb_textedit_move_to_last (line 632) | static void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_Text...
  function is_word_boundary (line 644) | static int is_word_boundary( STB_TEXTEDIT_STRING *str, int idx )
  function stb_textedit_move_to_word_previous (line 650) | static int stb_textedit_move_to_word_previous( STB_TEXTEDIT_STRING *str,...
  function stb_textedit_move_to_word_next (line 665) | static int stb_textedit_move_to_word_next( STB_TEXTEDIT_STRING *str, int...
  function stb_textedit_prep_selection_at_cursor (line 683) | static void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)
  function stb_textedit_cut (line 692) | static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState ...
  function stb_textedit_paste_internal (line 703) | static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_Tex...
  function stb_textedit_key (line 724) | static void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState...
  function stb_textedit_flush_redo (line 1109) | static void stb_textedit_flush_redo(StbUndoState *state)
  function stb_textedit_discard_undo (line 1116) | static void stb_textedit_discard_undo(StbUndoState *state)
  function stb_textedit_discard_redo (line 1138) | static void stb_textedit_discard_redo(StbUndoState *state)
  function StbUndoRecord (line 1161) | static StbUndoRecord *stb_text_create_undo_record(StbUndoState *state, i...
  function STB_TEXTEDIT_CHARTYPE (line 1185) | static STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, i...
  function stb_text_undo (line 1205) | static void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *s...
  function stb_text_redo (line 1273) | static void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *s...
  function stb_text_makeundo_insert (line 1324) | static void stb_text_makeundo_insert(STB_TexteditState *state, int where...
  function stb_text_makeundo_delete (line 1329) | static void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_Texte...
  function stb_text_makeundo_replace (line 1339) | static void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_Text...
  function stb_textedit_clear_state (line 1350) | static void stb_textedit_clear_state(STB_TexteditState *state, int is_si...
  function stb_textedit_initialize_state (line 1368) | static void stb_textedit_initialize_state(STB_TexteditState *state, int ...
  function stb_textedit_paste (line 1378) | static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditStat...

FILE: stb_tilemap_editor.h
  type stbte_tilemap (line 345) | typedef struct stbte_tilemap stbte_tilemap;
  type stbte_action (line 418) | enum stbte_action
  type stbte_action (line 438) | enum stbte_action
  type stbte__link (line 595) | typedef struct
  type stbte__tileinfo (line 782) | typedef struct
  type stbte__tiledata (line 792) | typedef short stbte__tiledata;
  type stbte__panel (line 861) | typedef struct
  type stbte__colorrect (line 870) | typedef struct
  type stbte__ui_t (line 877) | typedef struct
  type stbte__layer (line 928) | typedef struct
  type stbte_tilemap (line 942) | struct stbte_tilemap
  function stbte__init_gui (line 980) | static void stbte__init_gui(void)
  function stbte_tilemap (line 1007) | stbte_tilemap *stbte_create_map(int map_x, int map_y, int map_layers, in...
  function stbte_set_background_tile (line 1067) | void stbte_set_background_tile(stbte_tilemap *tm, short id)
  function stbte_set_spacing (line 1080) | void stbte_set_spacing(stbte_tilemap *tm, int spacing_x, int spacing_y, ...
  function stbte_set_sidewidths (line 1088) | void stbte_set_sidewidths(int left, int right)
  function stbte_set_display (line 1094) | void stbte_set_display(int x0, int y0, int x1, int y1)
  function stbte_define_tile (line 1102) | void stbte_define_tile(stbte_tilemap *tm, unsigned short id, unsigned in...
  function stbte_set_layername (line 1123) | void stbte_set_layername(stbte_tilemap *tm, int layer, const char *layer...
  function stbte_get_dimensions (line 1135) | void stbte_get_dimensions(stbte_tilemap *tm, int *max_x, int *max_y)
  function stbte_get_link (line 1157) | void stbte_get_link(stbte_tilemap *tm, int x, int y, int *destx, int *de...
  function stbte_set_property (line 1174) | void stbte_set_property(stbte_tilemap *tm, int x, int y, int n, float val)
  function stbte_set_link (line 1190) | void stbte_set_link(stbte_tilemap *tm, int x, int y, int destx, int desty)
  function stbte_set_dimensions (line 1203) | void stbte_set_dimensions(stbte_tilemap *tm, int map_x, int map_y)
  function stbte_clear_map (line 1213) | void stbte_clear_map(stbte_tilemap *tm)
  function stbte_set_tile (line 1230) | void stbte_set_tile(stbte_tilemap *tm, int x, int y, int layer, signed s...
  function stbte__choose_category (line 1243) | static void stbte__choose_category(stbte_tilemap *tm, int category)
  function stbte__strequal (line 1254) | static int stbte__strequal(char *p, char *q)
  function stbte__compute_tileinfo (line 1261) | static void stbte__compute_tileinfo(stbte_tilemap *tm)
  function stbte__prepare_tileinfo (line 1290) | static void stbte__prepare_tileinfo(stbte_tilemap *tm)
  function stbte__write_undo (line 1349) | static void stbte__write_undo(stbte_tilemap *tm, short value)
  function stbte__write_redo (line 1359) | static void stbte__write_redo(stbte_tilemap *tm, short value)
  function stbte__begin_undo (line 1369) | static void stbte__begin_undo(stbte_tilemap *tm)
  function stbte__end_undo (line 1377) | static void stbte__end_undo(stbte_tilemap *tm)
  function stbte__undo_record (line 1395) | static void stbte__undo_record(stbte_tilemap *tm, int x, int y, int i, i...
  function stbte__redo_record (line 1406) | static void stbte__redo_record(stbte_tilemap *tm, int x, int y, int i, i...
  function stbte__extract_float (line 1414) | static float stbte__extract_float(short s0, short s1)
  function stbte__extract_short (line 1422) | static short stbte__extract_short(float f, int slot)
  function stbte__undo_record_prop (line 1429) | static void stbte__undo_record_prop(stbte_tilemap *tm, int x, int y, int...
  function stbte__undo_record_prop_float (line 1441) | static void stbte__undo_record_prop_float(stbte_tilemap *tm, int x, int ...
  function stbte__redo_record_prop (line 1446) | static void stbte__redo_record_prop(stbte_tilemap *tm, int x, int y, int...
  function stbte__undo_find_end (line 1456) | static int stbte__undo_find_end(stbte_tilemap *tm)
  function stbte__undo (line 1474) | static void stbte__undo(stbte_tilemap *tm)
  function stbte__redo_find_end (line 1527) | static int stbte__redo_find_end(stbte_tilemap *tm)
  function stbte__redo (line 1545) | static void stbte__redo(stbte_tilemap *tm)
  function stbte__recompute_undo_available (line 1601) | static void stbte__recompute_undo_available(stbte_tilemap *tm)
  function stbte__undo_available (line 1607) | static int stbte__undo_available(stbte_tilemap *tm)
  function stbte__redo_available (line 1614) | static int stbte__redo_available(stbte_tilemap *tm)
  function stbte__set_link (line 1624) | static void stbte__set_link(stbte_tilemap *tm, int src_x, int src_y, int...
  function stbte__draw_rect (line 1653) | static void stbte__draw_rect(int x0, int y0, int x1, int y1, unsigned in...
  function stbte__draw_line (line 1659) | static void stbte__draw_line(int x0, int y0, int x1, int y1, unsigned in...
  function stbte__draw_link (line 1667) | static void stbte__draw_link(int x0, int y0, int x1, int y1, unsigned in...
  function stbte__draw_frame (line 1674) | static void stbte__draw_frame(int x0, int y0, int x1, int y1, unsigned i...
  function stbte__get_char_width (line 1682) | static int stbte__get_char_width(int ch)
  function stbte__draw_bitmask_as_columns (line 1692) | static void stbte__draw_bitmask_as_columns(int x, int y, short bitmask, ...
  function stbte__draw_bitmap (line 1708) | static void stbte__draw_bitmap(int x, int y, int w, short *bitmap, int c...
  function stbte__draw_text_core (line 1715) | static void stbte__draw_text_core(int x, int y, const char *str, int w, ...
  function stbte__draw_text (line 1730) | static void stbte__draw_text(int x, int y, const char *str, int w, int c...
  function stbte__text_width (line 1735) | static int stbte__text_width(const char *str)
  function stbte__draw_frame_delayed (line 1746) | static void stbte__draw_frame_delayed(int x0, int y0, int x1, int y1, in...
  function stbte__flush_delay (line 1754) | static void stbte__flush_delay(void)
  function stbte__activate (line 1764) | static void stbte__activate(int id)
  function stbte__hittest (line 1772) | static int stbte__hittest(int x0, int y0, int x1, int y1, int id)
  function stbte__button_core (line 1783) | static int stbte__button_core(int id)
  function stbte__draw_box (line 1810) | static void stbte__draw_box(int x0, int y0, int x1, int y1, int colormod...
  function stbte__draw_textbox (line 1816) | static void stbte__draw_textbox(int x0, int y0, int x1, int y1, char *te...
  function stbte__button (line 1822) | static int stbte__button(int colormode, const char *label, int x, int y,...
  function stbte__button_icon (line 1836) | static int stbte__button_icon(int colormode, char ch, int x, int y, int ...
  function stbte__minibutton (line 1853) | static int stbte__minibutton(int colormode, int x, int y, int ch, int id)
  function stbte__layerbutton (line 1864) | static int stbte__layerbutton(int x, int y, int ch, int id, int toggled,...
  function stbte__microbutton (line 1878) | static int stbte__microbutton(int x, int y, int size, int id, int colorm...
  function stbte__microbutton_dragger (line 1888) | static int stbte__microbutton_dragger(int x, int y, int size, int id, in...
  function stbte__category_button (line 1917) | static int stbte__category_button(const char *label, int x, int y, int w...
  function stbte__slider (line 1939) | static int stbte__slider(int x0, int w, int y, int range, int *value, in...
  function stbte__float_control (line 1982) | static int stbte__float_control(int x0, int y0, int w, float minv, float...
  function stbte__scrollbar (line 2036) | static void stbte__scrollbar(int x, int y0, int y1, int *val, int v0, in...
  function stbte__compute_digits (line 2077) | static void stbte__compute_digits(stbte_tilemap *tm)
  function stbte__is_single_selection (line 2087) | static int stbte__is_single_selection(void)
  type stbte__region_t (line 2094) | typedef struct
  function stbte__compute_panel_locations (line 2110) | static void stbte__compute_panel_locations(stbte_tilemap *tm)
  function stbte__activate_map (line 2275) | static void stbte__activate_map(int x, int y)
  function stbte__alert (line 2283) | static void stbte__alert(const char *msg)
  function stbte__brush_predict (line 2293) | static void stbte__brush_predict(stbte_tilemap *tm, short result[])
  function stbte__brush (line 2331) | static void stbte__brush(stbte_tilemap *tm, int x, int y)
  function stbte__erase_predict (line 2381) | static int stbte__erase_predict(stbte_tilemap *tm, short result[], int a...
  function stbte__erase (line 2451) | static int stbte__erase(stbte_tilemap *tm, int x, int y, int allow_any)
  function stbte__find_tile (line 2524) | static int stbte__find_tile(stbte_tilemap *tm, int tile_id)
  function stbte__eyedrop (line 2534) | static void stbte__eyedrop(stbte_tilemap *tm, int x, int y)
  function stbte__should_copy_properties (line 2571) | static int stbte__should_copy_properties(stbte_tilemap *tm)
  function stbte__paste_stack (line 2587) | static void stbte__paste_stack(stbte_tilemap *tm, short result[], short ...
  function stbte__clear_stack (line 2622) | static void stbte__clear_stack(stbte_tilemap *tm, short result[])
  function stbte__fillrect (line 2641) | static void stbte__fillrect(stbte_tilemap *tm, int x0, int y0, int x1, i...
  function stbte__select_rect (line 2659) | static void stbte__select_rect(stbte_tilemap *tm, int x0, int y0, int x1...
  function stbte__copy_properties (line 2668) | static void stbte__copy_properties(float *dest, float *src)
  function stbte__copy_cut (line 2675) | static void stbte__copy_cut(stbte_tilemap *tm, int cut)
  function stbte__in_rect (line 2738) | static int stbte__in_rect(int x, int y, int x0, int y0, int w, int h)
  function stbte__in_src_rect (line 2744) | static int stbte__in_src_rect(int x, int y)
  function stbte__in_dest_rect (line 2749) | static int stbte__in_dest_rect(int x, int y, int destx, int desty)
  function stbte__paste (line 2755) | static void stbte__paste(stbte_tilemap *tm, int mapx, int mapy)
  function stbte__drag_update (line 2818) | static void stbte__drag_update(stbte_tilemap *tm, int mapx, int mapy, in...
  function stbte__drag_place (line 2914) | static void stbte__drag_place(stbte_tilemap *tm, int mapx, int mapy)
  function stbte__tile_paint (line 2945) | static void stbte__tile_paint(stbte_tilemap *tm, int sx, int sy, int map...
  function stbte__tile (line 3024) | static void stbte__tile(stbte_tilemap *tm, int sx, int sy, int mapx, int...
  function stbte__start_paste (line 3303) | static void stbte__start_paste(stbte_tilemap *tm)
  function stbte__toolbar (line 3311) | static void stbte__toolbar(stbte_tilemap *tm, int x0, int y0, int w, int h)
  function stbte__info_value (line 3376) | static int stbte__info_value(const char *label, int x, int y, int val, i...
  function stbte__info (line 3396) | static void stbte__info(stbte_tilemap *tm, int x0, int y0, int w, int h)
  function stbte__layers (line 3427) | static void stbte__layers(stbte_tilemap *tm, int x0, int y0, int w, int h)
  function stbte__categories (line 3487) | static void stbte__categories(stbte_tilemap *tm, int x0, int y0, int w, ...
  function stbte__tile_in_palette (line 3514) | static void stbte__tile_in_palette(stbte_tilemap *tm, int x, int y, int ...
  function stbte__palette_of_tiles (line 3534) | static void stbte__palette_of_tiles(stbte_tilemap *tm, int x0, int y0, i...
  function stbte__props_panel (line 3577) | static void stbte__props_panel(stbte_tilemap *tm, int x0, int y0, int w,...
  function stbte__dump_colorstate (line 3675) | static void stbte__dump_colorstate(void)
  function stbte__colorpicker (line 3697) | static void stbte__colorpicker(int x0, int y0, int w, int h)
  function stbte__editor_traverse (line 3778) | static void stbte__editor_traverse(stbte_tilemap *tm)
  function stbte__do_event (line 4001) | static void stbte__do_event(stbte_tilemap *tm)
  function stbte__set_event (line 4040) | static void stbte__set_event(int event, int x, int y)
  function stbte_draw (line 4053) | void stbte_draw(stbte_tilemap *tm)
  function stbte_mouse_move (line 4059) | void stbte_mouse_move(stbte_tilemap *tm, int x, int y, int shifted, int ...
  function stbte_mouse_button (line 4067) | void stbte_mouse_button(stbte_tilemap *tm, int x, int y, int right, int ...
  function stbte_mouse_wheel (line 4078) | void stbte_mouse_wheel(stbte_tilemap *tm, int x, int y, int vscroll)
  function stbte_action (line 4083) | void stbte_action(stbte_tilemap *tm, enum stbte_action act)
  function stbte_tick (line 4106) | void stbte_tick(stbte_tilemap *tm, float dt)
  function stbte_mouse_sdl (line 4114) | void stbte_mouse_sdl(stbte_tilemap *tm, const void *sdl_event, float xs,...

FILE: stb_truetype.h
  function my_stbtt_initfont (line 287) | void my_stbtt_initfont(void)
  function my_stbtt_print (line 299) | void my_stbtt_print(float x, float y, char *text)
  function main (line 334) | int main(int argc, char **argv)
  function main (line 375) | int main(int arg, char **argv)
  type stbtt_uint8 (line 428) | typedef unsigned char   stbtt_uint8;
  type stbtt_int8 (line 429) | typedef signed   char   stbtt_int8;
  type stbtt_uint16 (line 430) | typedef unsigned short  stbtt_uint16;
  type stbtt_int16 (line 431) | typedef signed   short  stbtt_int16;
  type stbtt_uint32 (line 432) | typedef unsigned int    stbtt_uint32;
  type stbtt_int32 (line 433) | typedef signed   int    stbtt_int32;
  type stbtt__buf (line 513) | typedef struct
  type stbtt_bakedchar (line 527) | typedef struct
  type stbtt_aligned_quad (line 543) | typedef struct
  type stbtt_packedchar (line 575) | typedef struct
  type stbtt_pack_context (line 582) | typedef struct stbtt_pack_context stbtt_pack_context;
  type stbtt_fontinfo (line 583) | typedef struct stbtt_fontinfo stbtt_fontinfo;
  type stbrp_rect (line 585) | typedef struct stbrp_rect stbrp_rect;
  type stbtt_pack_range (line 619) | typedef struct
  type stbtt_pack_context (line 678) | struct stbtt_pack_context {
  type stbtt_fontinfo (line 713) | struct stbtt_fontinfo
  type stbtt_kerningentry (line 804) | typedef struct stbtt_kerningentry
  type stbtt_vertex (line 835) | typedef struct
  type stbtt__bitmap (line 924) | typedef struct
  function stbtt_uint8 (line 1133) | static stbtt_uint8 stbtt__buf_get8(stbtt__buf *b)
  function stbtt_uint8 (line 1140) | static stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b)
  function stbtt__buf_seek (line 1147) | static void stbtt__buf_seek(stbtt__buf *b, int o)
  function stbtt__buf_skip (line 1153) | static void stbtt__buf_skip(stbtt__buf *b, int o)
  function stbtt_uint32 (line 1158) | static stbtt_uint32 stbtt__buf_get(stbtt__buf *b, int n)
  function stbtt__buf (line 1168) | static stbtt__buf stbtt__new_buf(const void *p, size_t size)
  function stbtt__buf (line 1181) | static stbtt__buf stbtt__buf_range(const stbtt__buf *b, int o, int s)
  function stbtt__buf (line 1190) | static stbtt__buf stbtt__cff_get_index(stbtt__buf *b)
  function stbtt_uint32 (line 1204) | static stbtt_uint32 stbtt__cff_int(stbtt__buf *b)
  function stbtt__cff_skip_operand (line 1216) | static void stbtt__cff_skip_operand(stbtt__buf *b) {
  function stbtt__buf (line 1231) | static stbtt__buf stbtt__dict_get(stbtt__buf *b, int key)
  function stbtt__dict_get_ints (line 1246) | static void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, s...
  function stbtt__cff_index_count (line 1254) | static int stbtt__cff_index_count(stbtt__buf *b)
  function stbtt__buf (line 1260) | static stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i)
  function stbtt_uint16 (line 1286) | static stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0]*256 + p[1]; }
  function stbtt_int16 (line 1287) | static stbtt_int16 ttSHORT(stbtt_uint8 *p)   { return p[0]*256 + p[1]; }
  function stbtt_uint32 (line 1288) | static stbtt_uint32 ttULONG(stbtt_uint8 *p)  { return (p[0]<<24) + (p[1]...
  function stbtt_int32 (line 1289) | static stbtt_int32 ttLONG(stbtt_uint8 *p)    { return (p[0]<<24) + (p[1]...
  function stbtt__isfont (line 1294) | static int stbtt__isfont(stbtt_uint8 *font)
  function stbtt_uint32 (line 1306) | static stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fo...
  function stbtt_GetFontOffsetForIndex_internal (line 1319) | static int stbtt_GetFontOffsetForIndex_internal(unsigned char *font_coll...
  function stbtt_GetNumberOfFonts_internal (line 1338) | static int stbtt_GetNumberOfFonts_internal(unsigned char *font_collection)
  function stbtt__buf (line 1354) | static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)
  function stbtt__get_svg (line 1368) | static int stbtt__get_svg(stbtt_fontinfo *info)
  function stbtt_InitFont_internal (line 1383) | static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *...
  function STBTT_DEF (line 1496) | STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unico...
  function STBTT_DEF (line 1589) | STBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int un...
  function stbtt_setvertex (line 1594) | static void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int...
  function stbtt__GetGlyfOffset (line 1603) | static int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_in...
  function STBTT_DEF (line 1625) | STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_in...
  function STBTT_DEF (line 1641) | STBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int code...
  function STBTT_DEF (line 1646) | STBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_i...
  function stbtt__close_shape (line 1658) | static int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, ...
  function stbtt__GetGlyphShapeTT (line 1674) | static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_...
  type stbtt__csctx (line 1897) | typedef struct
  function stbtt__track_vertex (line 1911) | static void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_in...
  function stbtt__csctx_v (line 1920) | static void stbtt__csctx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int3...
  function stbtt__csctx_close_shape (line 1936) | static void stbtt__csctx_close_shape(stbtt__csctx *ctx)
  function stbtt__csctx_rmove_to (line 1942) | static void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy)
  function stbtt__csctx_rline_to (line 1950) | static void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy)
  function stbtt__csctx_rccurve_to (line 1957) | static void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float ...
  function stbtt__buf (line 1968) | static stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)
  function stbtt__buf (line 1982) | static stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info,...
  function stbtt__run_charstring (line 2010) | static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_i...
  function stbtt__GetGlyphShapeT2 (line 2269) | static int stbtt__GetGlyphShapeT2(const stbtt_fontinfo *info, int glyph_...
  function stbtt__GetGlyphInfoT2 (line 2286) | static int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_i...
  function STBTT_DEF (line 2297) | STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_...
  function STBTT_DEF (line 2305) | STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int gl...
  function STBTT_DEF (line 2317) | STBTT_DEF int  stbtt_GetKerningTableLength(const stbtt_fontinfo *info)
  function STBTT_DEF (line 2332) | STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_ke...
  function stbtt__GetGlyphKernInfoAdvance (line 2359) | static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, in...
  function stbtt_int32 (line 2389) | static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, i...
  function stbtt_int32 (line 2447) | static stbtt_int32  stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int...
  function stbtt_int32 (line 2496) | static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *...
  function STBTT_DEF (line 2610) | STBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int...
  function STBTT_DEF (line 2622) | STBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info,...
  function STBTT_DEF (line 2629) | STBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, in...
  function STBTT_DEF (line 2634) | STBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *as...
  function STBTT_DEF (line 2641) | STBTT_DEF int  stbtt_GetFontVMetricsOS2(const stbtt_fontinfo *info, int ...
  function STBTT_DEF (line 2652) | STBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int ...
  function STBTT_DEF (line 2660) | STBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, fl...
  function STBTT_DEF (line 2666) | STBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *in...
  function STBTT_DEF (line 2672) | STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)
  function STBTT_DEF (line 2677) | STBTT_DEF stbtt_uint8 *stbtt_FindSVGDoc(const stbtt_fontinfo *info, int gl)
  function STBTT_DEF (line 2694) | STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, cons...
  function STBTT_DEF (line 2711) | STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unic...
  function STBTT_DEF (line 2721) | STBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *fon...
  function STBTT_DEF (line 2739) | STBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int g...
  function STBTT_DEF (line 2744) | STBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo ...
  function STBTT_DEF (line 2749) | STBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, i...
  type stbtt__hheap_chunk (line 2758) | typedef struct stbtt__hheap_chunk
  type stbtt__hheap (line 2763) | typedef struct stbtt__hheap
  function stbtt__hheap_free (line 2791) | static void stbtt__hheap_free(stbtt__hheap *hh, void *p)
  function stbtt__hheap_cleanup (line 2797) | static void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)
  type stbtt__edge (line 2807) | typedef struct stbtt__edge {
  type stbtt__active_edge (line 2813) | typedef struct stbtt__active_edge
  function stbtt__active_edge (line 2835) | static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__ed...
  function stbtt__active_edge (line 2857) | static stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__ed...
  function stbtt__fill_active_edges (line 2882) | static void stbtt__fill_active_edges(unsigned char *scanline, int len, s...
  function stbtt__rasterize_sorted_edges (line 2924) | static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__...
  function stbtt__handle_clipped_edge (line 3028) | static void stbtt__handle_clipped_edge(float *scanline, int x, stbtt__ac...
  function stbtt__sized_trapezoid_area (line 3065) | static float stbtt__sized_trapezoid_area(float height, float top_width, ...
  function stbtt__position_trapezoid_area (line 3072) | static float stbtt__position_trapezoid_area(float height, float tx0, flo...
  function stbtt__sized_triangle_area (line 3077) | static float stbtt__sized_triangle_area(float height, float width)
  function stbtt__fill_active_edges_new (line 3082) | static void stbtt__fill_active_edges_new(float *scanline, float *scanlin...
  function stbtt__rasterize_sorted_edges (line 3297) | static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__...
  function stbtt__sort_edges_ins_sort (line 3399) | static void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n)
  function stbtt__sort_edges_quicksort (line 3417) | static void stbtt__sort_edges_quicksort(stbtt__edge *p, int n)
  function stbtt__sort_edges (line 3479) | static void stbtt__sort_edges(stbtt__edge *p, int n)
  type stbtt__point (line 3485) | typedef struct
  function stbtt__rasterize (line 3490) | static void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, i...
  function stbtt__add_point (line 3547) | static void stbtt__add_point(stbtt__point *points, int n, float x, float y)
  function stbtt__tesselate_curve (line 3555) | static int stbtt__tesselate_curve(stbtt__point *points, int *num_points,...
  function stbtt__tesselate_cubic (line 3575) | static void stbtt__tesselate_cubic(stbtt__point *points, int *num_points...
  function stbtt__point (line 3618) | static stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num...
  function STBTT_DEF (line 3695) | STBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_...
  function STBTT_DEF (line 3708) | STBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)
  function STBTT_DEF (line 3758) | STBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info,...
  function STBTT_DEF (line 3777) | STBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigne...
  function STBTT_DEF (line 3787) | STBTT_DEF void stbtt_MakeCodepointBitmapSubpixelPrefilter(const stbtt_fo...
  function STBTT_DEF (line 3792) | STBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *i...
  function STBTT_DEF (line 3802) | STBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, uns...
  function stbtt_BakeFontBitmap_internal (line 3813) | static int stbtt_BakeFontBitmap_internal(unsigned char *data, int offset...
  function STBTT_DEF (line 3859) | STBTT_DEF void stbtt_GetBakedQuad(const stbtt_bakedchar *chardata, int p...
  type stbrp_coord (line 3887) | typedef int stbrp_coord;
  type stbrp_context (line 3900) | typedef struct
  type stbrp_node (line 3906) | typedef struct
  type stbrp_rect (line 3911) | struct stbrp_rect
  function stbrp_init_target (line 3917) | static void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_...
  function stbrp_pack_rects (line 3928) | static void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int ...
  function STBTT_DEF (line 3957) | STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pi...
  function STBTT_DEF (line 3989) | STBTT_DEF void stbtt_PackEnd  (stbtt_pack_context *spc)
  function STBTT_DEF (line 3995) | STBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsign...
  function STBTT_DEF (line 4005) | STBTT_DEF void stbtt_PackSetSkipMissingCodepoints(stbtt_pack_context *sp...
  function stbtt__h_prefilter (line 4012) | static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int ...
  function stbtt__v_prefilter (line 4074) | static void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int ...
  function stbtt__oversample_shift (line 4136) | static float stbtt__oversample_shift(int oversample)
  function STBTT_DEF (line 4149) | STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, c...
  function STBTT_DEF (line 4184) | STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontin...
  function STBTT_DEF (line 4208) | STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *sp...
  function STBTT_DEF (line 4297) | STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, st...
  function STBTT_DEF (line 4302) | STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsign...
  function STBTT_DEF (line 4338) | STBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, const unsigne...
  function STBTT_DEF (line 4350) | STBTT_DEF void stbtt_GetScaledFontVMetrics(const unsigned char *fontdata...
  function STBTT_DEF (line 4363) | STBTT_DEF void stbtt_GetPackedQuad(const stbtt_packedchar *chardata, int...
  function stbtt__ray_intersect_bezier (line 4398) | static int stbtt__ray_intersect_bezier(float orig[2], float ray[2], floa...
  function equal (line 4462) | static int equal(float *a, float *b)
  function stbtt__compute_crossings_x (line 4467) | static int stbtt__compute_crossings_x(float x, float y, int nverts, stbt...
  function stbtt__cuberoot (line 4535) | static float stbtt__cuberoot( float x )
  function stbtt__solve_cubic (line 4544) | static int stbtt__solve_cubic(float a, float b, float c, float* r)
  function STBTT_DEF (line 4767) | STBTT_DEF void stbtt_FreeSDF(unsigned char *bitmap, void *userdata)
  function stbtt_int32 (line 4778) | static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint...
  function stbtt_CompareUTF8toUTF16_bigendian_internal (line 4817) | static int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len...
  function STBTT_DEF (line 4824) | STBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font...
  function stbtt__matchpair (line 4845) | static int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint...
  function stbtt__matches (line 4892) | static int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_ui...
  function stbtt_FindMatchingFont_internal (line 4921) | static int stbtt_FindMatchingFont_internal(unsigned char *font_collectio...
  function STBTT_DEF (line 4937) | STBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,
  function STBTT_DEF (line 4944) | STBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int...
  function STBTT_DEF (line 4949) | STBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)
  function STBTT_DEF (line 4954) | STBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *...
  function STBTT_DEF (line 4959) | STBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, cons...
  function STBTT_DEF (line 4964) | STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len...

FILE: stb_vorbis.c
  type stb_vorbis_alloc (line 118) | typedef struct
  type stb_vorbis (line 127) | typedef struct stb_vorbis stb_vorbis;
  type stb_vorbis_info (line 129) | typedef struct
  type stb_vorbis_comment (line 141) | typedef struct
  type STBVorbisError (line 374) | enum STBVorbisError
  type uint8 (line 644) | typedef unsigned char  uint8;
  type int8 (line 645) | typedef   signed char   int8;
  type uint16 (line 646) | typedef unsigned short uint16;
  type int16 (line 647) | typedef   signed short  int16;
  type uint32 (line 648) | typedef unsigned int   uint32;
  type int32 (line 649) | typedef   signed int    int32;
  type codetype (line 656) | typedef float codetype;
  type Codebook (line 680) | typedef struct
  type Floor0 (line 703) | typedef struct
  type Floor1 (line 714) | typedef struct
  type Floor (line 730) | typedef union
  type Residue (line 736) | typedef struct
  type MappingChannel (line 746) | typedef struct
  type Mapping (line 753) | typedef struct
  type Mode (line 762) | typedef struct
  type CRCscan (line 770) | typedef struct
  type ProbedPage (line 779) | typedef struct
  type stb_vorbis (line 785) | struct stb_vorbis
  type vorb (line 911) | typedef struct stb_vorbis vorb;
  function error (line 913) | static int error(vorb *f, enum STBVorbisError e)
  function setup_free (line 963) | static void setup_free(vorb *f, void *p)
  function setup_temp_free (line 980) | static void setup_temp_free(vorb *f, void *p, int sz)
  function crc32_init (line 992) | static void crc32_init(void)
  function uint32 (line 1003) | static __forceinline uint32 crc32_update(uint32 crc, uint8 byte)
  function bit_reverse (line 1010) | static unsigned int bit_reverse(unsigned int n)
  function square (line 1019) | static float square(float x)
  function ilog (line 1027) | static int ilog(int32 n)
  function float32_unpack (line 1057) | static float float32_unpack(uint32 x)
  function add_entry (line 1075) | static void add_entry(Codebook *c, uint32 huff_code, int symbol, int cou...
  function compute_codewords (line 1086) | static int compute_codewords(Codebook *c, uint8 *len, int n, uint32 *val...
  function compute_accelerated_huffman (line 1134) | static void compute_accelerated_huffman(Codebook *c)
  function uint32_compare (line 1162) | static int STBV_CDECL uint32_compare(const void *p, const void *q)
  function include_in_sort (line 1169) | static int include_in_sort(Codebook *c, uint8 len)
  function compute_sorted_huffman (line 1179) | static void compute_sorted_huffman(Codebook *c, uint8 *lengths, uint32 *...
  function vorbis_validate (line 1233) | static int vorbis_validate(uint8 *data)
  function lookup1_values (line 1241) | static int lookup1_values(int entries, int dim)
  function compute_twiddle_factors (line 1254) | static void compute_twiddle_factors(int n, float *A, float *B, float *C)
  function compute_window (line 1271) | static void compute_window(int n, float *window)
  function compute_bitreverse (line 1278) | static void compute_bitreverse(int n, uint16 *rev)
  function init_blocksize (line 1286) | static int init_blocksize(vorb *f, int b, int n)
  function neighbors (line 1303) | static void neighbors(uint16 *x, int n, int *plow, int *phigh)
  type stbv__floor_ordering (line 1315) | typedef struct
  function point_compare (line 1320) | static int STBV_CDECL point_compare(const void *p, const void *q)
  function uint8 (line 1337) | static uint8 get8(vorb *z)
  function uint32 (line 1353) | static uint32 get32(vorb *f)
  function getn (line 1363) | static int getn(vorb *z, uint8 *data, int n)
  function skip (line 1382) | static void skip(vorb *z, int n)
  function set_file_offset (line 1397) | static int set_file_offset(stb_vorbis *f, unsigned int loc)
  function capture_pattern (line 1431) | static int capture_pattern(vorb *f)
  function start_page_no_capturepattern (line 1444) | static int start_page_no_capturepattern(vorb *f)
  function start_page (line 1497) | static int start_page(vorb *f)
  function start_packet (line 1503) | static int start_packet(vorb *f)
  function maybe_start_packet (line 1518) | static int maybe_start_packet(vorb *f)
  function next_segment (line 1539) | static int next_segment(vorb *f)
  function get8_packet_raw (line 1563) | static int get8_packet_raw(vorb *f)
  function get8_packet (line 1575) | static int get8_packet(vorb *f)
  function get32_packet (line 1582) | static int get32_packet(vorb *f)
  function flush_packet (line 1592) | static void flush_packet(vorb *f)
  function uint32 (line 1599) | static uint32 get_bits(vorb *f, int n)
  function prep_huffman (line 1634) | static __forceinline void prep_huffman(vorb *f)
  function codebook_decode_scalar_raw (line 1656) | static int codebook_decode_scalar_raw(vorb *f, Codebook *c)
  function codebook_decode_scalar (line 1733) | static int codebook_decode_scalar(vorb *f, Codebook *c)
  function codebook_decode_start (line 1775) | static int codebook_decode_start(vorb *f, Codebook *c)
  function codebook_decode (line 1795) | static int codebook_decode(vorb *f, Codebook *c, float *output, int len)
  function codebook_decode_step (line 1834) | static int codebook_decode_step(vorb *f, Codebook *c, float *output, int...
  function codebook_decode_deinterleave_repeat (line 1865) | static int codebook_decode_deinterleave_repeat(vorb *f, Codebook *c, flo...
  function predict_point (line 1935) | static int predict_point(int x, int x0, int x1, int y0, int y1)
  function draw_line (line 2034) | static __forceinline void draw_line(float *output, int x0, int y0, int x...
  function residue_decode (line 2083) | static int residue_decode(vorb *f, Codebook *book, float *target, int of...
  function decode_residue (line 2104) | static void decode_residue(vorb *f, float *residue_buffers[], int ch, in...
  function inverse_mdct_slow (line 2289) | void inverse_mdct_slow(float *buffer, int n)
  function inverse_mdct_slow (line 2312) | void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype)
  function dct_iv_slow (line 2333) | void dct_iv_slow(float *buffer, int n)
  function inverse_mdct_slow (line 2350) | void inverse_mdct_slow(float *buffer, int n, vorb *f, int blocktype)
  type mdct_lookup (line 2371) | typedef struct
  function inverse_mdct (line 2388) | void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
  function imdct_step3_iter0_loop (line 2408) | static void imdct_step3_iter0_loop(int n, float *e, int i_off, int k_off...
  function imdct_step3_inner_r_loop (line 2453) | static void imdct_step3_inner_r_loop(int lim, float *e, int d0, int k_of...
  function imdct_step3_inner_s_loop (line 2503) | static void imdct_step3_inner_s_loop(int n, float *e, int i_off, int k_o...
  function iter_54 (line 2554) | static __forceinline void iter_54(float *z)
  function imdct_step3_inner_s_loop_ld654 (line 2586) | static void imdct_step3_inner_s_loop_ld654(int n, float *e, int i_off, f...
  function inverse_mdct (line 2629) | static void inverse_mdct(float *buffer, int n, vorb *f, int blocktype)
  function inverse_mdct_naive (line 2933) | void inverse_mdct_naive(float *buffer, int n)
  type int16 (line 3068) | typedef int16 YTYPE;
  type YTYPE (line 3070) | typedef int YTYPE;
  function do_floor (line 3072) | static int do_floor(vorb *f, Mapping *map, int i, int n, float *target, ...
  function vorbis_decode_initial (line 3124) | static int vorbis_decode_initial(vorb *f, int *p_left_start, int *p_left...
  function vorbis_decode_packet_rest (line 3180) | static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int lef...
  function vorbis_decode_packet (line 3449) | static int vorbis_decode_packet(vorb *f, int *len, int *p_left, int *p_r...
  function vorbis_finish_frame (line 3456) | static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)
  function vorbis_pump_first_frame (line 3509) | static int vorbis_pump_first_frame(stb_vorbis *f)
  function is_whole_packet_present (line 3519) | static int is_whole_packet_present(stb_vorbis *f)
  function start_decoder (line 3580) | static int start_decoder(vorb *f)
  function vorbis_deinit (line 4208) | static void vorbis_deinit(stb_vorbis *p)
  function stb_vorbis_close (line 4271) | void stb_vorbis_close(stb_vorbis *p)
  function vorbis_init (line 4278) | static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
  function stb_vorbis_get_sample_offset (line 4297) | int stb_vorbis_get_sample_offset(stb_vorbis *f)
  function stb_vorbis_info (line 4305) | stb_vorbis_info stb_vorbis_get_info(stb_vorbis *f)
  function stb_vorbis_comment (line 4317) | stb_vorbis_comment stb_vorbis_get_comment(stb_vorbis *f)
  function stb_vorbis_get_error (line 4326) | int stb_vorbis_get_error(stb_vorbis *f)
  function stb_vorbis (line 4333) | static stb_vorbis * vorbis_alloc(stb_vorbis *f)
  function stb_vorbis_flush_pushdata (line 4341) | void stb_vorbis_flush_pushdata(stb_vorbis *f)
  function vorbis_search_for_page_pushdata (line 4353) | static int vorbis_search_for_page_pushdata(vorb *f, uint8 *data, int dat...
  function stb_vorbis_decode_frame_pushdata (line 4444) | int stb_vorbis_decode_frame_pushdata(
  function stb_vorbis (line 4514) | stb_vorbis *stb_vorbis_open_pushdata(
  function stb_vorbis_get_file_offset (line 4545) | unsigned int stb_vorbis_get_file_offset(stb_vorbis *f)
  function uint32 (line 4561) | static uint32 vorbis_find_page(stb_vorbis *f, uint32 *end, uint32 *last)
  function get_seek_page_info (line 4643) | static int get_seek_page_info(stb_vorbis *f, ProbedPage *z)
  function go_to_page_before (line 4675) | static int go_to_page_before(stb_vorbis *f, unsigned int limit_offset)
  function seek_to_sample_coarse (line 4700) | static int seek_to_sample_coarse(stb_vorbis *f, uint32 sample_number)
  function peek_decode_initial (line 4855) | static int peek_decode_initial(vorb *f, int *p_left_start, int *p_left_e...
  function stb_vorbis_seek_frame (line 4880) | int stb_vorbis_seek_frame(stb_vorbis *f, unsigned int sample_number)
  function stb_vorbis_seek (line 4919) | int stb_vorbis_seek(stb_vorbis *f, unsigned int sample_number)
  function stb_vorbis_seek_start (line 4936) | int stb_vorbis_seek_start(stb_vorbis *f)
  function stb_vorbis_stream_length_in_samples (line 4946) | unsigned int stb_vorbis_stream_length_in_samples(stb_vorbis *f)
  function stb_vorbis_stream_length_in_seconds (line 5021) | float stb_vorbis_stream_length_in_seconds(stb_vorbis *f)
  function stb_vorbis_get_frame_float (line 5028) | int stb_vorbis_get_frame_float(stb_vorbis *f, int *channels, float ***ou...
  function stb_vorbis (line 5052) | stb_vorbis * stb_vorbis_open_file_section(FILE *file, int close_on_free,...
  function stb_vorbis (line 5073) | stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *er...
  function stb_vorbis (line 5083) | stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, ...
  function stb_vorbis (line 5099) | stb_vorbis * stb_vorbis_open_memory(const unsigned char *data, int len, ...
  type float_conv (line 5148) | typedef union {
  function copy_samples (line 5165) | static void copy_samples(short *dest, float *src, int len)
  function compute_samples (line 5178) | static void compute_samples(int mask, short *output, int num_c, float **...
  function compute_stereo_samples (line 5204) | static void compute_stereo_samples(short *output, int num_c, float **dat...
  function convert_samples_short (line 5244) | static void convert_samples_short(int buf_c, short **buffer, int b_offse...
  function stb_vorbis_get_frame_short (line 5260) | int stb_vorbis_get_frame_short(stb_vorbis *f, int num_c, short **buffer,...
  function convert_channels_short_interleaved (line 5270) | static void convert_channels_short_interleaved(int buf_c, short *buffer,...
  function stb_vorbis_get_frame_short_interleaved (line 5296) | int stb_vorbis_get_frame_short_interleaved(stb_vorbis *f, int num_c, sho...
  function stb_vorbis_get_samples_short_interleaved (line 5309) | int stb_vorbis_get_samples_short_interleaved(stb_vorbis *f, int channels...
  function stb_vorbis_get_samples_short (line 5328) | int stb_vorbis_get_samples_short(stb_vorbis *f, int channels, short **bu...
  function stb_vorbis_decode_filename (line 5346) | int stb_vorbis_decode_filename(const char *filename, int *channels, int ...
  function stb_vorbis_decode_memory (line 5386) | int stb_vorbis_decode_memory(const uint8 *mem, int len, int *channels, i...
  function stb_vorbis_get_samples_float_interleaved (line 5426) | int stb_vorbis_get_samples_float_interleaved(stb_vorbis *f, int channels...
  function stb_vorbis_get_samples_float (line 5453) | int stb_vorbis_get_samples_float(stb_vorbis *f, int channels, float **bu...

FILE: stb_voxel_render.h
  type stbvox_mesh_maker (line 233) | typedef struct stbvox_mesh_maker stbvox_mesh_maker;
  type stbvox_input_description (line 234) | typedef struct stbvox_input_description stbvox_input_description;
  type stbvox_uniform_info (line 529) | typedef struct stbvox_uniform_info stbvox_uniform_info;
  type stbvox_uniform_info (line 592) | struct stbvox_uniform_info
  function setup_uniforms (line 610) | void setup_uniforms(GLuint shader, float camera_pos[4], GLuint tex1, GLu...
  type stbvox_block_type (line 705) | typedef unsigned short stbvox_block_type;
  type stbvox_block_type (line 707) | typedef unsigned char stbvox_block_type;
  type stbvox_rgb (line 711) | typedef struct
  type stbvox_input_description (line 726) | struct stbvox_input_description
  type stbvox_mesh_maker (line 1182) | struct stbvox_mesh_maker
  type stbvox_uint16 (line 1225) | typedef uint16_t stbvox_uint16;
  type stbvox_uint32 (line 1226) | typedef uint32_t stbvox_uint32;
  type stbvox_uint16 (line 1228) | typedef unsigned short stbvox_uint16;
  type stbvox_uint32 (line 1229) | typedef unsigned int   stbvox_uint32;
  type stbvox_uint32 (line 1321) | typedef stbvox_uint32 stbvox_mesh_vertex;
  type stbvox_uint16 (line 1325) | typedef stbvox_uint16 stbvox_mesh_vertex;
  type stbvox_uint16 (line 1329) | typedef stbvox_uint16 stbvox_mesh_vertex;
  type stbvox_uint8 (line 1333) | typedef stbvox_uint8 stbvox_mesh_vertex;
  type stbvox_mesh_face (line 1341) | typedef struct
  function stbvox_build_default_palette (line 1544) | static void stbvox_build_default_palette(void)
  function STBVXDEC (line 1970) | STBVXDEC char *stbvox_get_vertex_shader(void)
  function STBVXDEC (line 1975) | STBVXDEC char *stbvox_get_fragment_shader(void)
  function STBVXDEC (line 1980) | STBVXDEC char *stbvox_get_fragment_shader_alpha_only(void)
  function STBVXDEC (line 2006) | STBVXDEC int stbvox_get_uniform_info(stbvox_uniform_info *info, int unif...
  type stbvox_rotate (line 2017) | typedef struct
  type stbvox_pos (line 2025) | typedef struct
  function stbvox_mesh_face (line 2042) | stbvox_mesh_face stbvox_compute_mesh_face_value(stbvox_mesh_maker *mm, s...
  function stbvox_get_quad_vertex_pointer (line 2651) | void stbvox_get_quad_vertex_pointer(stbvox_mesh_maker *mm, int mesh, stb...
  function stbvox_make_mesh_for_face (line 2676) | void stbvox_make_mesh_for_face(stbvox_mesh_maker *mm, stbvox_rotate rot,...
  function stbvox_make_12_split_mesh_for_face (line 2843) | static void stbvox_make_12_split_mesh_for_face(stbvox_mesh_maker *mm, st...
  function stbvox_make_03_split_mesh_for_face (line 2866) | static void stbvox_make_03_split_mesh_for_face(stbvox_mesh_maker *mm, st...
  function stbvox_make_mesh_for_block (line 2894) | static void stbvox_make_mesh_for_block(stbvox_mesh_maker *mm, stbvox_pos...
  function stbvox_make_mesh_for_block_with_geo (line 2963) | static void stbvox_make_mesh_for_block_with_geo(stbvox_mesh_maker *mm, s...
  function stbvox_make_mesh_for_column (line 3399) | static void stbvox_make_mesh_for_column(stbvox_mesh_maker *mm, int x, in...
  function stbvox_bring_up_to_date (line 3467) | static void stbvox_bring_up_to_date(stbvox_mesh_maker *mm)
  function stbvox_make_mesh (line 3491) | int stbvox_make_mesh(stbvox_mesh_maker *mm)
  function stbvox_init_mesh_maker (line 3522) | void stbvox_init_mesh_maker(stbvox_mesh_maker *mm)
  function stbvox_get_buffer_count (line 3531) | int stbvox_get_buffer_count(stbvox_mesh_maker *mm)
  function stbvox_get_buffer_size_per_quad (line 3537) | int stbvox_get_buffer_size_per_quad(stbvox_mesh_maker *mm, int n)
  function stbvox_reset_buffers (line 3542) | void stbvox_reset_buffers(stbvox_mesh_maker *mm)
  function stbvox_set_buffer (line 3551) | void stbvox_set_buffer(stbvox_mesh_maker *mm, int mesh, int slot, void *...
  function stbvox_set_default_mesh (line 3566) | void stbvox_set_default_mesh(stbvox_mesh_maker *mm, int mesh)
  function stbvox_get_quad_count (line 3571) | int stbvox_get_quad_count(stbvox_mesh_maker *mm, int mesh)
  function stbvox_input_description (line 3576) | stbvox_input_description *stbvox_get_input_description(stbvox_mesh_maker...
  function stbvox_set_input_range (line 3581) | void stbvox_set_input_range(stbvox_mesh_maker *mm, int x0, int y0, int z...
  function stbvox_get_transform (line 3598) | void stbvox_get_transform(stbvox_mesh_maker *mm, float transform[3][3])
  function stbvox_get_bounds (line 3618) | void stbvox_get_bounds(stbvox_mesh_maker *mm, float bounds[2][3])
  function stbvox_set_mesh_coordinates (line 3628) | void stbvox_set_mesh_coordinates(stbvox_mesh_maker *mm, int x, int y, in...
  function stbvox_set_input_stride (line 3635) | void stbvox_set_input_stride(stbvox_mesh_maker *mm, int x_stride_in_byte...
  function main (line 3684) | int main(int argc, char **argv)

FILE: tests/caveview/cave_main.c
  function print_string (line 40) | static void print_string(float x, float y, char *text, float r, float g,...
  function print (line 58) | static void print(char *text, ...)
  function camera_to_worldspace (line 74) | void camera_to_worldspace(float world[3], float cam_x, float cam_y, floa...
  function process_tick_raw (line 118) | void process_tick_raw(float dt)
  function process_tick (line 171) | void process_tick(float dt)
  function update_view (line 180) | void update_view(float dx, float dy)
  function draw_stats (line 203) | void draw_stats(void)
  function draw_main (line 239) | void draw_main(void)
  function error (line 305) | void error(char *s)
  function ods (line 311) | void ods(char *fmt, ...)
  function draw (line 329) | void draw(void)
  function loopmode (line 351) | int loopmode(float dt, int real, int in_client)
  function active_control_set (line 385) | void active_control_set(int key)
  function active_control_clear (line 390) | void active_control_clear(int key)
  function process_sdl_mouse (line 397) | void  process_sdl_mouse(SDL_Event *e)
  function process_event (line 402) | void process_event(SDL_Event *e)
  function getTimestep (line 493) | static float getTimestep(float minimum_time)
  function gl_debug (line 514) | void APIENTRY gl_debug(GLenum source, GLenum type, GLuint id, GLenum sev...
  function enable_synchronous (line 520) | void enable_synchronous(void)
  function SDL_main (line 529) | int SDL_main(int argc, char **argv)

FILE: tests/caveview/cave_mesher.c
  function convert_fastchunk_inplace (line 332) | void convert_fastchunk_inplace(fast_chunk *fc)
  function make_converted_fastchunk (line 458) | void make_converted_fastchunk(fast_chunk *fc, int x, int
Condensed preview — 145 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,496K chars).
[
  {
    "path": ".NO_AI/README.md",
    "chars": 81,
    "preview": "\n[Use of AI is forbidden, see CONTRIBUTING.md for details.](../CONTRIBUTING.md)\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/1-stb_image-doesn-t-load-specific-image-correctly.md",
    "chars": 978,
    "preview": "---\nname: stb_image Doesn't Load Specific Image Correctly\nabout: if an image displays wrong in your program, and you've "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/2-bug_report.md",
    "chars": 998,
    "preview": "---\nname: Bug report\nabout: if you're having trouble using a library, try the support forum instead\ntitle: ''\nlabels: ''"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/3-feature_request.md",
    "chars": 606,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: 4 enhancement\nassignees: ''\n\n---\n\n**"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 224,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: support forum\n    url: https://github.com/nothings/stb/discussions/"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 627,
    "preview": "* Delete this list before clicking CREATE PULL REQUEST\n* Make sure you're using a special branch just for this pull requ"
  },
  {
    "path": ".github/workflows/ci-fuzz.yml",
    "chars": 595,
    "preview": "name: CIFuzz\non: [pull_request]\njobs:\n  Fuzzing:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Build Fuzzers\n      u"
  },
  {
    "path": ".gitignore",
    "chars": 16,
    "preview": "*.o\n*.obj\n*.exe\n"
  },
  {
    "path": ".travis.yml",
    "chars": 88,
    "preview": "language: C\narch:\n  - AMD64\n  - ppc64le\ninstall: true\nscript:\n  - cd tests\n  - make all\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1855,
    "preview": "AI AND LLM ARE FORBIDDEN\n========================\n\nThis project doesn't accept code or documentation generated\nby LLMs o"
  },
  {
    "path": "LICENSE",
    "chars": 2510,
    "preview": "This software is available under 2 licenses -- choose whichever you prefer.\n--------------------------------------------"
  },
  {
    "path": "README.md",
    "chars": 9332,
    "preview": "<!---   THIS FILE IS AUTOMATICALLY GENERATED, DO NOT CHANGE IT BY HAND   --->\n\nstb\n===\n\nsingle-file public domain (or MI"
  },
  {
    "path": "SECURITY.md",
    "chars": 269,
    "preview": "# Security Policy\nThis project discusses security-relevant bugs in public in Github Issues and Pull Requests, and it may"
  },
  {
    "path": "data/herringbone/license.txt",
    "chars": 200,
    "preview": "All files in this directory are in the public domain. Where\na public domain declaration is not recognized, you are grant"
  },
  {
    "path": "deprecated/rrsprintf.h",
    "chars": 36050,
    "preview": "#ifndef RR_SPRINTF_H_INCLUDE\n#define RR_SPRINTF_H_INCLUDE\n\n/*\nSingle file sprintf replacement.\n\nOriginally written by Je"
  },
  {
    "path": "deprecated/stb.h",
    "chars": 417564,
    "preview": "/* stb.h - v2.37 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h\n          no warranty is offered or imp"
  },
  {
    "path": "deprecated/stb_image.c",
    "chars": 148975,
    "preview": "/* stb_image - v1.35 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c\n   when you control the images yo"
  },
  {
    "path": "deprecated/stb_image_resize.h",
    "chars": 116516,
    "preview": "/* stb_image_resize - v0.97 - public domain image resizing\n   by Jorge L Rodriguez (@VinoBS) - 2014\n   http://github.com"
  },
  {
    "path": "deprecated/stretch_test.c",
    "chars": 542,
    "preview": "// check that stb_truetype compiles with no stb_rect_pack.h\n#define STB_TRUETYPE_IMPLEMENTATION\n#include \"stb_truetype.h"
  },
  {
    "path": "deprecated/stretchy_buffer.h",
    "chars": 11526,
    "preview": "// stretchy_buffer.h - v1.04 - public domain - nothings.org/stb\n// a vector<>-like dynamic array for C\n//\n// version his"
  },
  {
    "path": "deprecated/stretchy_buffer.txt",
    "chars": 1129,
    "preview": "// stretchy buffer // init: NULL // free: sbfree() // push_back: sbpush() // size: sbcount() //\n#define sbfree(a)       "
  },
  {
    "path": "docs/other_libs.md",
    "chars": 53,
    "preview": "Moved to https://github.com/nothings/single_file_libs"
  },
  {
    "path": "docs/stb_howto.txt",
    "chars": 7130,
    "preview": "Lessons learned about how to make a header-file library\nV1.0\nSeptember 2013 Sean Barrett\n\nThings to do in an stb-style h"
  },
  {
    "path": "docs/stb_voxel_render_interview.md",
    "chars": 7211,
    "preview": "# An interview with STB about stb_voxel_render.h\n\n**Q:**\nI suppose you really like Minecraft?\n\n**A:**\nNot really. I mean"
  },
  {
    "path": "docs/why_public_domain.md",
    "chars": 5070,
    "preview": "My collected rationales for placing these libraries\nin the public domain:\n\n1. Public domain vs. viral licenses\n\n  Why is"
  },
  {
    "path": "stb_c_lexer.h",
    "chars": 34718,
    "preview": "// stb_c_lexer.h - v0.12 - public domain Sean Barrett 2013\n// lexer for making little C-like languages with recursive-de"
  },
  {
    "path": "stb_connected_components.h",
    "chars": 37299,
    "preview": "// stb_connected_components - v0.96 - public domain connected components on grids\n//                                    "
  },
  {
    "path": "stb_divide.h",
    "chars": 14507,
    "preview": "// stb_divide.h - v0.94 - public domain - Sean Barrett, Feb 2010\n// Three kinds of divide/modulus of signed integers.\n//"
  },
  {
    "path": "stb_ds.h",
    "chars": 69015,
    "preview": "/* stb_ds.h - v0.67 - public domain data structures - Sean Barrett 2019\n\n   This is a single-header-file library that pr"
  },
  {
    "path": "stb_dxt.h",
    "chars": 28319,
    "preview": "// stb_dxt.h - v1.12 - DXT1/DXT5 compressor - public domain\n// original by fabian \"ryg\" giesen - ported to C by stb\n// u"
  },
  {
    "path": "stb_easy_font.h",
    "chars": 12813,
    "preview": "// stb_easy_font.h - v1.1 - bitmap font for 3D rendering - public domain\n// Sean Barrett, Feb 2015\n//\n//    Easy-to-depl"
  },
  {
    "path": "stb_herringbone_wang_tile.h",
    "chars": 43167,
    "preview": "/* stbhw - v0.7 -  http://nothings.org/gamedev/herringbone\n   Herringbone Wang Tile Generator - Sean Barrett 2014 - publ"
  },
  {
    "path": "stb_hexwave.h",
    "chars": 27473,
    "preview": "// stb_hexwave - v0.5 - public domain, initial release 2021-04-01\n//\n// A flexible anti-aliased (bandlimited) digital au"
  },
  {
    "path": "stb_image.h",
    "chars": 283010,
    "preview": "/* stb_image - v2.30 - public domain image loader - http://nothings.org/stb\n                                  no warrant"
  },
  {
    "path": "stb_image_resize2.h",
    "chars": 457839,
    "preview": "/* stb_image_resize2 - v2.18 - public domain image resizing\n\n   by Jeff Roberts (v2) and Jorge L Rodriguez\n   http://git"
  },
  {
    "path": "stb_image_resize_test/dotimings.c",
    "chars": 6256,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef _MSC_VER\n\n#define stop() __debugbreak()\n#include <win"
  },
  {
    "path": "stb_image_resize_test/old_image_resize.h",
    "chars": 119349,
    "preview": "/* stb_image_resize - v0.96 - public domain image resizing\n   by Jorge L Rodriguez (@VinoBS) - 2014\n   http://github.com"
  },
  {
    "path": "stb_image_resize_test/oldir.c",
    "chars": 2545,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n\n#ifdef _MSC_VER\n#define stop() __debugbreak()\n#else\n#define stop() __builtin_tra"
  },
  {
    "path": "stb_image_resize_test/stbirtest.c",
    "chars": 30009,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n//#define HEAVYTM\n#include \"tm.h\"\n\n#ifdef RADUSETM3\ntm_api *"
  },
  {
    "path": "stb_image_resize_test/vf_train.c",
    "chars": 28489,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#define stop() __debugbreak()\n#include <windows.h>\n#define i"
  },
  {
    "path": "stb_image_write.h",
    "chars": 71221,
    "preview": "/* stb_image_write - v1.16 - public domain - http://nothings.org/stb\n   writes out PNG/BMP/TGA/JPEG/HDR images to C stdi"
  },
  {
    "path": "stb_include.h",
    "chars": 9186,
    "preview": "// stb_include.h - v0.02 - parse and process #include directives - public domain\n//\n// To build this, in one source file"
  },
  {
    "path": "stb_leakcheck.h",
    "chars": 7149,
    "preview": "// stb_leakcheck.h - v0.6 - quick & dirty malloc leak-checking - public domain\n// LICENSE\n//\n//   See end of file.\n\n#ifd"
  },
  {
    "path": "stb_perlin.h",
    "chars": 17918,
    "preview": "// stb_perlin.h - v0.5 - perlin noise\n// public domain single-file C implementation by Sean Barrett\n//\n// LICENSE\n//\n// "
  },
  {
    "path": "stb_rect_pack.h",
    "chars": 20199,
    "preview": "// stb_rect_pack.h - v1.01 - public domain - rectangle packing\n// Sean Barrett 2014\n//\n// Useful for e.g. packing rectan"
  },
  {
    "path": "stb_sprintf.h",
    "chars": 58223,
    "preview": "// stb_sprintf - v1.10 - public domain snprintf() implementation\n// originally by Jeff Roberts / RAD Game Tools, 2015/10"
  },
  {
    "path": "stb_textedit.h",
    "chars": 54016,
    "preview": "// stb_textedit.h - v1.14  - public domain - Sean Barrett\n// Development of this library was sponsored by RAD Game Tools"
  },
  {
    "path": "stb_tilemap_editor.h",
    "chars": 146564,
    "preview": "// stb_tilemap_editor.h - v0.42 - Sean Barrett - http://nothings.org/stb\n// placed in the public domain - not copyrighte"
  },
  {
    "path": "stb_truetype.h",
    "chars": 199192,
    "preview": "// stb_truetype.h - v1.26 - public domain\n// authored from 2009-2021 by Sean Barrett / RAD Game Tools\n//\n// ============"
  },
  {
    "path": "stb_vorbis.c",
    "chars": 192790,
    "preview": "// Ogg Vorbis audio decoder - v1.22 - public domain\n// http://nothings.org/stb_vorbis/\n//\n// Original version written by"
  },
  {
    "path": "stb_voxel_render.h",
    "chars": 161156,
    "preview": "// stb_voxel_render.h - v0.89 - Sean Barrett, 2015 - public domain\n//\n// This library helps render large-scale \"voxel\" w"
  },
  {
    "path": "tests/Makefile",
    "chars": 697,
    "preview": "INCLUDES = -I..\nCFLAGS = -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -DSTB_DIVIDE_TEST\nCPPFLAGS = -Wno-write-strin"
  },
  {
    "path": "tests/c_lexer_test.c",
    "chars": 3710,
    "preview": "#define STB_C_LEX_C_DECIMAL_INTS    Y   //  \"0|[1-9][0-9]*\"                        CLEX_intlit\n#define STB_C_LEX_C_HEX_I"
  },
  {
    "path": "tests/c_lexer_test.dsp",
    "chars": 3975,
    "preview": "# Microsoft Developer Studio Project File - Name=\"c_lexer_test\" - Package Owner=<4>\n# Microsoft Developer Studio Generat"
  },
  {
    "path": "tests/caveview/README.md",
    "chars": 3448,
    "preview": "# FAQ\n\n### How to run it?\n\nThere's no GUI. Find a directory with Minecraft Anvil files (.mca).\nCopy a Minecraft \"terrain"
  },
  {
    "path": "tests/caveview/cave_main.c",
    "chars": 15920,
    "preview": "#define _WIN32_WINNT 0x400\n\n#include <assert.h>\n#include <windows.h>\n\n// stb.h\n#define STB_DEFINE\n#include \"stb.h\"\n\n// s"
  },
  {
    "path": "tests/caveview/cave_mesher.c",
    "chars": 29062,
    "preview": "// This file takes minecraft chunks (decoded by cave_parse) and\n// uses stb_voxel_render to turn them into vertex buffer"
  },
  {
    "path": "tests/caveview/cave_parse.c",
    "chars": 17227,
    "preview": "#include <assert.h>\n#include <stdio.h>\n#include <limits.h>\n#include <stdlib.h>\n\n#define FAST_CHUNK   // disabling this e"
  },
  {
    "path": "tests/caveview/cave_parse.h",
    "chars": 973,
    "preview": "#ifndef INCLUDE_CAVE_PARSE_H\n#define INCLUDE_CAVE_PARSE_H\n\ntypedef struct\n{\n   unsigned char block;\n   unsigned char dat"
  },
  {
    "path": "tests/caveview/cave_render.c",
    "chars": 29519,
    "preview": "// This file renders vertex buffers, converts raw meshes\n// to GL meshes, and manages threads that do the raw-mesh\n// bu"
  },
  {
    "path": "tests/caveview/caveview.dsp",
    "chars": 4735,
    "preview": "# Microsoft Developer Studio Project File - Name=\"caveview\" - Package Owner=<4>\n# Microsoft Developer Studio Generated B"
  },
  {
    "path": "tests/caveview/caveview.dsw",
    "chars": 510,
    "preview": "Microsoft Developer Studio Workspace File, Format Version 6.00\n# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n##"
  },
  {
    "path": "tests/caveview/caveview.h",
    "chars": 1215,
    "preview": "#ifndef INCLUDE_CAVEVIEW_H\n#define INCLUDE_CAVEVIEW_H\n\n#include \"stb.h\"\n\n#include \"stb_voxel_render.h\"\n\ntypedef struct\n{"
  },
  {
    "path": "tests/caveview/glext.h",
    "chars": 729795,
    "preview": "#ifndef __glext_h_\n#define __glext_h_ 1\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n** Copyright (c) 2013 The Khronos Gr"
  },
  {
    "path": "tests/caveview/glext_list.h",
    "chars": 1194,
    "preview": "GLARB(ActiveTexture,ACTIVETEXTURE)\nGLARB(ClientActiveTexture,CLIENTACTIVETEXTURE)\nGLARB(MultiTexCoord2f,MULTITEXCOORD2F)"
  },
  {
    "path": "tests/caveview/main.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/caveview/stb_gl.h",
    "chars": 38107,
    "preview": "// stbgl - v0.04 - Sean Barrett 2008 - public domain\n//\n// Note that the gl extensions support requires glext.h. In fact"
  },
  {
    "path": "tests/caveview/stb_glprog.h",
    "chars": 20283,
    "preview": "// stb_glprog v0.02 public domain         functions to reduce GLSL boilerplate\n// http://nothings.org/stb/stb_glprog.h  "
  },
  {
    "path": "tests/caveview/win32/SDL_windows_main.c",
    "chars": 5518,
    "preview": "/*\n    SDL_windows_main.c, placed in the public domain by Sam Lantinga  4/13/98\n\n    The WinMain function -- calls your "
  },
  {
    "path": "tests/fuzz_main.c",
    "chars": 970,
    "preview": "#include <stdint.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n/* fuzz target entry point, works without libFuzzer */\n\nint "
  },
  {
    "path": "tests/grid_reachability.c",
    "chars": 9291,
    "preview": "#define STB_CONNECTED_COMPONENTS_IMPLEMENTATION\n#define STBCC_GRID_COUNT_X_LOG2  10\n#define STBCC_GRID_COUNT_Y_LOG2  10\n"
  },
  {
    "path": "tests/herringbone.dsp",
    "chars": 4147,
    "preview": "# Microsoft Developer Studio Project File - Name=\"herringbone\" - Package Owner=<4>\n# Microsoft Developer Studio Generate"
  },
  {
    "path": "tests/herringbone_generator.c",
    "chars": 3016,
    "preview": "#define STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION\n#include \"stb_herringbone_wang_tile.h\"\n\n#define STB_IMAGE_WRITE_IMPLEME"
  },
  {
    "path": "tests/herringbone_map.c",
    "chars": 2496,
    "preview": "#include <stdio.h>\n\n#define STB_HBWANG_MAX_X  500\n#define STB_HBWANG_MAX_Y  500\n\n#define STB_HERRINGBONE_WANG_TILE_IMPLE"
  },
  {
    "path": "tests/herringbone_map.dsp",
    "chars": 4166,
    "preview": "# Microsoft Developer Studio Project File - Name=\"herringbone_map\" - Package Owner=<4>\n# Microsoft Developer Studio Gene"
  },
  {
    "path": "tests/image_test.c",
    "chars": 6124,
    "preview": "#define STBI_WINDOWS_UTF8\n\n#define STB_IMAGE_WRITE_IMPLEMENTATION\n#include \"stb_image_write.h\"\n\n#define STB_IMAGE_IMPLEM"
  },
  {
    "path": "tests/image_test.dsp",
    "chars": 4213,
    "preview": "# Microsoft Developer Studio Project File - Name=\"image_test\" - Package Owner=<4>\n# Microsoft Developer Studio Generated"
  },
  {
    "path": "tests/image_write_test.c",
    "chars": 1874,
    "preview": "#ifdef __clang__\n#define STBIWDEF static inline\n#endif\n#define STB_IMAGE_WRITE_STATIC\n#define STB_IMAGE_WRITE_IMPLEMENTA"
  },
  {
    "path": "tests/ossfuzz.sh",
    "chars": 1125,
    "preview": "#!/bin/bash -eu\n# This script is meant to be run by\n# https://github.com/google/oss-fuzz/blob/master/projects/stb/Docker"
  },
  {
    "path": "tests/oversample/README.md",
    "chars": 4636,
    "preview": "# Font character oversampling for rendering from atlas textures\n\nTL,DR: Run oversample.exe on a windows machine to see t"
  },
  {
    "path": "tests/oversample/main.c",
    "chars": 8567,
    "preview": "#pragma warning(disable:4244; disable:4305; disable:4018)\n#include <assert.h>\n#include <ctype.h>\n\n#define STB_WINMAIN\n#i"
  },
  {
    "path": "tests/oversample/oversample.dsp",
    "chars": 3700,
    "preview": "# Microsoft Developer Studio Project File - Name=\"oversample\" - Package Owner=<4>\n# Microsoft Developer Studio Generated"
  },
  {
    "path": "tests/oversample/oversample.dsw",
    "chars": 514,
    "preview": "Microsoft Developer Studio Workspace File, Format Version 6.00\n# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n##"
  },
  {
    "path": "tests/oversample/stb_wingraph.h",
    "chars": 24875,
    "preview": "// stb_wingraph.h  v0.01 - public domain windows graphics programming\n// wraps WinMain, ChoosePixelFormat, ChangeDisplay"
  },
  {
    "path": "tests/pg_test/pg_test.c",
    "chars": 3198,
    "preview": "#define STB_DEFINE\n#include \"stb.h\"\n#define STB_PG_IMPLEMENTATION\n#include \"stb_pg.h\"\n#define STB_IMAGE_IMPLEMENTATION\n#"
  },
  {
    "path": "tests/pngsuite/PngSuite.LICENSE",
    "chars": 167,
    "preview": "PngSuite\n--------\n\nPermission to use, copy, modify and distribute these images for any\npurpose and without fee is hereby"
  },
  {
    "path": "tests/pngsuite/ref_results.csv",
    "chars": 13451,
    "preview": "filename,width,height,ncomp,error,hash\npngsuite/16bit/basi0g16.png,32,32,1,,0xfc8f2f99\npngsuite/16bit/basi2c16.png,32,32"
  },
  {
    "path": "tests/prerelease/stb_lib.h",
    "chars": 106783,
    "preview": "/* stb_lib.h - v1.00 - http://nothings.org/stb\n   no warranty is offered or implied; use this code at your own risk\n\n =="
  },
  {
    "path": "tests/resample_test.cpp",
    "chars": 39332,
    "preview": "#define _CRT_SECURE_NO_WARNINGS\n#include <stdlib.h>\n#include <stdio.h>\n\n#if defined(_WIN32) && _MSC_VER > 1200\n#define S"
  },
  {
    "path": "tests/resample_test_c.c",
    "chars": 181,
    "preview": "#define STB_IMAGE_RESIZE_IMPLEMENTATION\n#define STB_IMAGE_RESIZE_STATIC\n#include \"stb_image_resize.h\"\n\n// Just to make s"
  },
  {
    "path": "tests/resize.dsp",
    "chars": 4030,
    "preview": "# Microsoft Developer Studio Project File - Name=\"resize\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Bui"
  },
  {
    "path": "tests/sdf/sdf_test.c",
    "chars": 4626,
    "preview": "#define STB_DEFINE\n#include \"stb.h\"\n\n#define STB_TRUETYPE_IMPLEMENTATION\n#include \"stb_truetype.h\"\n\n#define STB_IMAGE_WR"
  },
  {
    "path": "tests/stb.c",
    "chars": 124964,
    "preview": "/*\n * Unit tests for \"stb.h\"\n */\n\n#define _CRT_SECURE_NO_WARNINGS\n//#include <windows.h>\n#include <stdio.h>\n#include <st"
  },
  {
    "path": "tests/stb.dsp",
    "chars": 6454,
    "preview": "# Microsoft Developer Studio Project File - Name=\"stb\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Build "
  },
  {
    "path": "tests/stb.dsw",
    "chars": 2610,
    "preview": "Microsoft Developer Studio Workspace File, Format Version 6.00\n# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!\n\n##"
  },
  {
    "path": "tests/stb_c_lexer_fuzzer.cpp",
    "chars": 2081,
    "preview": "#define STB_C_LEX_C_DECIMAL_INTS    Y  \n#define STB_C_LEX_C_HEX_INTS        Y\n#define STB_C_LEX_C_OCTAL_INTS      Y\n#def"
  },
  {
    "path": "tests/stb_cpp.cpp",
    "chars": 2233,
    "preview": "#define WIN32_MEAN_AND_LEAN\n#define WIN32_LEAN_AND_MEAN\n//#include <windows.h>\n#include <conio.h>\n#define STB_DEFINE\n#if"
  },
  {
    "path": "tests/stb_cpp.dsp",
    "chars": 4095,
    "preview": "# Microsoft Developer Studio Project File - Name=\"stb_cpp\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Bu"
  },
  {
    "path": "tests/stb_png.dict",
    "chars": 158,
    "preview": "header_png=\"\\x89PNG\\x0d\\x0a\\x1a\\x0a\"\n\nsection_idat=\"IDAT\"\nsection_iend=\"IEND\"\nsection_ihdr=\"IHDR\"\nsection_plte=\"PLTE\"\nse"
  },
  {
    "path": "tests/stb_static.c",
    "chars": 293,
    "preview": "#define STBI_WINDOWS_UTF8\n#define STB_IMAGE_STATIC\n#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"\n\n#define STB_"
  },
  {
    "path": "tests/stbi_read_fuzzer.c",
    "chars": 502,
    "preview": "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define STB_IMAGE_IMPLEMENTATION\n\n#include \"../stb_image.h\"\n\n\nint LLVMFuzzerTest"
  },
  {
    "path": "tests/stblib.dsp",
    "chars": 4128,
    "preview": "# Microsoft Developer Studio Project File - Name=\"stblib\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Bui"
  },
  {
    "path": "tests/stblib_test.c",
    "chars": 193,
    "preview": "#include \"prerelease/stb_lib.h\"\n#define STB_LIB_IMPLEMENTATION\n#include \"prerelease/stb_lib.h\"\n\n//#define STB_REGEX_IMPL"
  },
  {
    "path": "tests/stblib_test_companion.c",
    "chars": 114,
    "preview": "//#include \"stb_regex.h\"\n//#include \"stb_regex.h\"\n#include \"prerelease/stb_lib.h\"\n#include \"prerelease/stb_lib.h\"\n"
  },
  {
    "path": "tests/stretch_test.dsp",
    "chars": 4057,
    "preview": "# Microsoft Developer Studio Project File - Name=\"stretch_test\" - Package Owner=<4>\n# Microsoft Developer Studio Generat"
  },
  {
    "path": "tests/test.sbm",
    "chars": 1318,
    "preview": "[link]\n-Xlinker advapi32.lib\n\n[args]\n-I .. -Wall -D_DEBUG\n\n[compilers]\n#clang for x64,vcvars_2015_x64,clang --analyze\ncl"
  },
  {
    "path": "tests/test_c_compilation.c",
    "chars": 1223,
    "preview": "#define STB_IMAGE_RESIZE_IMPLEMENTATION\n#include \"stb_image_resize2.h\"\n\n#define STB_SPRINTF_IMPLEMENTATION\n#include \"stb"
  },
  {
    "path": "tests/test_c_lexer.c",
    "chars": 3774,
    "preview": "#include \"stb_c_lexer.h\"\n\n#define STB_C_LEX_C_DECIMAL_INTS    Y   //  \"0|[1-9][0-9]*\"                        CLEX_intlit"
  },
  {
    "path": "tests/test_cpp_compilation.cpp",
    "chars": 5926,
    "preview": "#define STB_IMAGE_WRITE_STATIC\n#define STBIWDEF static inline\n\n#include \"stb_image.h\"\n#include \"stb_rect_pack.h\"\n#includ"
  },
  {
    "path": "tests/test_ds.c",
    "chars": 32297,
    "preview": "#ifdef DS_PERF\n#define _CRT_SECURE_NO_WARNINGS\n#define _CRT_NONSTDC_NO_DEPRECATE\n#define _CRT_NON_CONFORMING_SWPRINTFS\n\n"
  },
  {
    "path": "tests/test_ds_cpp.cpp",
    "chars": 13936,
    "preview": "#include <stdio.h>\n\n#ifdef DS_TEST\n#define STBDS_UNIT_TESTS\n#endif\n\n#ifdef DS_STATS\n#define STBDS_STATISTICS\n#endif\n\n#if"
  },
  {
    "path": "tests/test_dxt.c",
    "chars": 21,
    "preview": "#include \"stb_dxt.h\"\n"
  },
  {
    "path": "tests/test_easyfont.c",
    "chars": 212,
    "preview": "#include \"stb_easy_font.h\"\n\nvoid ef_dummy(void)\n{\n   // suppress unsused-function warning\n   stb_easy_font_spacing(0);\n "
  },
  {
    "path": "tests/test_image.c",
    "chars": 135,
    "preview": "#ifdef __clang__\n#define STBIDEF static inline\n#endif\n\n#define STB_IMAGE_STATIC\n#define STB_IMAGE_IMPLEMENTATION\n#includ"
  },
  {
    "path": "tests/test_image_write.c",
    "chars": 154,
    "preview": "#ifdef __clang__\n#define STBIWDEF static inline\n#endif\n\n#define STB_IMAGE_WRITE_IMPLEMENTATION\n#define STB_IMAGE_WRITE_S"
  },
  {
    "path": "tests/test_perlin.c",
    "chars": 23,
    "preview": "#include \"stb_perlin.h\""
  },
  {
    "path": "tests/test_png_paeth.c",
    "chars": 1054,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n\n// Reference Paeth filter as per PNG spec\nstatic int ref_paeth(int a, int b, int"
  },
  {
    "path": "tests/test_png_regress.c",
    "chars": 1923,
    "preview": "#include <stdio.h>\n#include <stdlib.h>\n\n#define STBI_WINDOWS_UTF8\n\n#ifdef _WIN32\n#define WIN32 // what stb.h checks\n#pra"
  },
  {
    "path": "tests/test_siphash.c",
    "chars": 463,
    "preview": "#include <stdio.h>\n\n#define STB_DS_IMPLEMENTATION\n#define STBDS_SIPHASH_2_4\n#define STBDS_TEST_SIPHASH_2_4\n#include \"../"
  },
  {
    "path": "tests/test_sprintf.c",
    "chars": 7337,
    "preview": "\n#define USE_STB 1\n\n#if USE_STB\n# include \"stb_sprintf.h\"\n# define SPRINTF stbsp_sprintf\n# define SNPRINTF stbsp_snprint"
  },
  {
    "path": "tests/test_truetype.c",
    "chars": 4407,
    "preview": "#ifndef _CRT_SECURE_NO_WARNINGS\n// Fixes Compile Errors for Visual Studio 2005 or newer\n  #define _CRT_SECURE_NO_WARNING"
  },
  {
    "path": "tests/test_vorbis.c",
    "chars": 477,
    "preview": "#define STB_VORBIS_HEADER_ONLY\n#include \"stb_vorbis.c\"\n#include \"stb.h\"\n\nextern void stb_vorbis_dumpmem(void);\n\n#ifdef V"
  },
  {
    "path": "tests/test_voxel.c",
    "chars": 29,
    "preview": "#include \"stb_voxel_render.h\""
  },
  {
    "path": "tests/textedit_sample.c",
    "chars": 3696,
    "preview": "// I haven't actually tested this yet, this is just to make sure it compiles\n\n#include <stdlib.h>\n#include <string.h> //"
  },
  {
    "path": "tests/tilemap_editor_integration_example.c",
    "chars": 6352,
    "preview": "// This isn't compilable as-is, as it was extracted from a working\n// integration-in-a-game and makes reference to symbo"
  },
  {
    "path": "tests/truetype_test_win32.c",
    "chars": 5178,
    "preview": "// tested in VC6 (1998) and VS 2019\n#define _CRT_SECURE_NO_WARNINGS\n#define WIN32_MEAN_AND_LEAN\n#include <windows.h>\n\n#i"
  },
  {
    "path": "tests/vorbseek/vorbseek.c",
    "chars": 3885,
    "preview": "#include <assert.h>\n#include <string.h>\n#include <stdlib.h>\n#include <stdio.h>\n\n#define STB_VORBIS_HEADER_ONLY\n#include "
  },
  {
    "path": "tests/vorbseek/vorbseek.dsp",
    "chars": 4087,
    "preview": "# Microsoft Developer Studio Project File - Name=\"vorbseek\" - Package Owner=<4>\n# Microsoft Developer Studio Generated B"
  },
  {
    "path": "tools/README.footer.md",
    "chars": 5800,
    "preview": "\nFAQ\n---\n\n#### What's the license?\n\nThese libraries are in the public domain. You can do anything you\nwant with them. Yo"
  },
  {
    "path": "tools/README.header.md",
    "chars": 943,
    "preview": "stb\n===\n\nsingle-file public domain (or MIT licensed) libraries for C/C++\n\n# This project discusses security-relevant bug"
  },
  {
    "path": "tools/README.list",
    "chars": 2103,
    "preview": "stb_vorbis.c                | audio            | decode ogg vorbis files from file/memory to float/16-bit signed output\n"
  },
  {
    "path": "tools/build_matrix.c",
    "chars": 4912,
    "preview": "#define STB_DEFINE\n#include \"stb.h\"\n\n// true if no error\nint run_command(char *batch_file, char *command)\n{\n   char buff"
  },
  {
    "path": "tools/easy_font_maker.c",
    "chars": 5160,
    "preview": "// This program was used to encode the data for stb_simple_font.h\n\n#define STB_DEFINE\n#include \"stb.h\"\n#define STB_IMAGE"
  },
  {
    "path": "tools/make_readme.c",
    "chars": 2592,
    "preview": "#define STB_DEFINE\n#include \"../stb.h\"\n\nint main(int argc, char  **argv)\n{\n   int i;\n   int hlen, flen, listlen, total_l"
  },
  {
    "path": "tools/make_readme.dsp",
    "chars": 4087,
    "preview": "# Microsoft Developer Studio Project File - Name=\"make_readme\" - Package Owner=<4>\n# Microsoft Developer Studio Generate"
  },
  {
    "path": "tools/mr.bat",
    "chars": 18,
    "preview": "debug\\make_readme\n"
  },
  {
    "path": "tools/trailing_whitespace.c",
    "chars": 790,
    "preview": "#define STB_DEFINE\n#include \"stb.h\"\n\nint main(int argc, char **argv)\n{\n   int i;\n   for (i=1; i < argc; ++i) {\n      int"
  },
  {
    "path": "tools/unicode/unicode.dsp",
    "chars": 3894,
    "preview": "# Microsoft Developer Studio Project File - Name=\"unicode\" - Package Owner=<4>\n# Microsoft Developer Studio Generated Bu"
  },
  {
    "path": "tools/unicode.c",
    "chars": 21826,
    "preview": "#define STB_DEFINE\n#include \"../stb.h\"\n\n// create unicode mappings\n//\n// Two kinds of mappings:\n//     map to a number\n/"
  }
]

// ... and 6 more files (download for full content)

About this extraction

This page contains the full source code of the nothings/stb GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 145 files (4.2 MB), approximately 1.1M tokens, and a symbol index with 2642 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!