diff --git a/README.md b/README.md index f95b57df4acbcdf879da208adb19e0917be33565..93f4ffb21fac294e035309bef04d1af648bb01d2 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,16 @@ single-file public domain libraries for C/C++ library | lastest version | category | description --------------------- | ---- | -------- | -------------------------------- -**stb_vorbis.c** | 1.0 | audio | decode ogg vorbis files from file/memory to float/16-bit signed output -**stb_image.c** | 1.35 | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC -**stb_truetype.h** | 0.8 | graphics | parse, decode, and rasterize characters from truetype fonts +**stb_vorbis.c** | 1.0 | audio | decode ogg vorbis files from file/memory to float/16-bit signed output +**stb_image.c** | 1.35 | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC +**stb_truetype.h** | 0.8 | graphics | parse, decode, and rasterize characters from truetype fonts **stb_image_write.h** | 0.93 | graphics | image writing to disk: PNG, TGA, BMP -**stb_textedit.h** | 1.2 | UI | guts of a text editor for games etc implementing them from scratch -**stb_dxt.h** | 1.04 | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor -**stb_perlin.h** | 0.2 | 3D graphics | revised Perlin noise (3D input, 1D output) -**stb_c_lexer.h** | 0.04 | parsing | simplify writing parsers for C-like languages -**stb_divide.h** | 0.91 | math | more useful 32-bit modulus e.g. "euclidean divide" -**stb.h** | 2.23 | misc | helper functions for C, mostly redundant in C++; basically author's personal stuff +**stb_textedit.h** | 1.2 | UI | guts of a text editor for games etc implementing them from scratch +**stb_dxt.h** | 1.04 | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor +**stb_perlin.h** | 0.2 | 3D graphics | revised Perlin noise (3D input, 1D output) +**stb_c_lexer.h** | 0.04 | parsing | simplify writing parsers for C-like languages +**stb_divide.h** | 0.91 | math | more useful 32-bit modulus e.g. "euclidean divide" +**stb.h** | 2.23 | misc | helper functions for C, mostly redundant in C++; basically author's personal stuff FAQ --- diff --git a/docs/git_how.txt b/docs/git_how.txt new file mode 100644 index 0000000000000000000000000000000000000000..2256ca6c94b6755c93b8c8afda0f976b100a0f7e --- /dev/null +++ b/docs/git_how.txt @@ -0,0 +1,11 @@ +git checkout working +-- do work +git add ... +git commit + +to upload: + +git checkout master +git pull ; usually unnecessary +git merge working +git push diff --git a/stb.h b/stb.h index c17246c73ae69a6b29e554dca675e816bcc2f0e0..f903140c16c490bc0cf64b2b6625b5defdc58d3a 100644 --- a/stb.h +++ b/stb.h @@ -1,12 +1,9 @@ -/* stb-2.23 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h +/* stb.h - v2.23 - 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++. - Email bug reports, feature requests, etc. to 'sean' at the same site. - - Documentation: http://nothings.org/stb/stb_h.html Unit tests: http://nothings.org/stb/stb.c diff --git a/stb_c_lexer.h b/stb_c_lexer.h index c77e344a7aacbf71a58fb0453507e51280920d86..380992c7e7d03476ee92bb2e6ba6896741a7ebe5 100644 --- a/stb_c_lexer.h +++ b/stb_c_lexer.h @@ -1,4 +1,4 @@ -// stb_c_lexer.h 0.04 -- public domain Sean Barrett 2013 +// stb_c_lexer.h - v0.04 - public domain Sean Barrett 2013 // lexer for making little C-like languages with recursive-descent parsers // // This file provides both the interface and the implementation. diff --git a/stb_image.c b/stb_image.c index 17bb2fe873acacf8a1563b6cb809072725a99c30..de0d935fcdd19fd73ea90f98d6687df117a50d1f 100644 --- a/stb_image.c +++ b/stb_image.c @@ -1,4 +1,4 @@ -/* stbi-1.35 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c +/* stb_image - v1.35 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c when you control the images you're loading no warranty implied; use at your own risk diff --git a/stb_image_write.h b/stb_image_write.h index d0617a910469015fbde3dd38e08d256218809b15..4ad281a3ece4841a68a8b9e77e53717deb4579f1 100644 --- a/stb_image_write.h +++ b/stb_image_write.h @@ -1,4 +1,4 @@ -/* stbiw-0.93 - public domain - http://nothings.org/stb/stb_image_write.h +/* stb_image_write - v0.93 - public domain - http://nothings.org/stb/stb_image_write.h writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010 no warranty implied; use at your own risk diff --git a/stb_perlin.h b/stb_perlin.h index bdd684375c77929523ba8a0fad056a39e9e8150c..8ff7419528bf700ce97b0171dc3a4e8e67ce3ca6 100644 --- a/stb_perlin.h +++ b/stb_perlin.h @@ -1,4 +1,4 @@ -// stb_perlin.h -- perlin noise -- v0.2 +// stb_perlin.h - v0.2 - perlin noise // public domain single-file C implementation by Sean Barrett // // to create the implementation, diff --git a/stb_vorbis.c b/stb_vorbis.c index 802032e88f44c6bba67ceccf4a9c71c987e153e8..bb13e36acafbffe8dd1ea6c6c100bfed986a2c12 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -1,4 +1,4 @@ -// Ogg Vorbis audio decoder -- public domain -- version 1.0 +// Ogg Vorbis audio decoder - v1.0 - public domain // http://nothings.org/stb_vorbis/ // // Written by Sean Barrett in 2007, last updated in 2014 diff --git a/tests/image_test.c b/tests/image_test.c index acaf33a2ec9d0aa0322941bed94bb33c0053b733..d49abdc5593acee8819aae5bb4bfc7191523c087 100644 --- a/tests/image_test.c +++ b/tests/image_test.c @@ -12,4 +12,4 @@ int main(int argc, char **argv) if (data) stbi_write_png("c:/x/result.png", w, h, 4, data, w*4); return 0; -} \ No newline at end of file +} diff --git a/tests/stb.dsw b/tests/stb.dsw index c1448a54e73d21b4cec6a792301e74fda46dd5b5..c07ce5ad5866222c69789cb07e1f82138425ce48 100644 --- a/tests/stb.dsw +++ b/tests/stb.dsw @@ -15,6 +15,18 @@ Package=<4> ############################################################################### +Project: "make_readme"=..\tools\make_readme\make_readme.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "stb"=.\stb.dsp - Package Owner=<4> Package=<5> diff --git a/tools/README.footer.md b/tools/README.footer.md new file mode 100644 index 0000000000000000000000000000000000000000..d3ddc68b104450c1d8a49ccd7c6c58eb1f4810b5 --- /dev/null +++ b/tools/README.footer.md @@ -0,0 +1,65 @@ + +FAQ +--- + +#### What's the license? + +These libraries are in the public domain (or the equivalent where that is not +possible). You can do anything you want with them. You have no legal obligation +to do anything else, although I appreciate attribution. + +#### If I wrap an stb library in a new library, does the new library have to be public domain? + +No. + +#### A lot 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. + +#### 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 semi-robust +way of namespacing the filenames and source function names. + +#### Will you add more image types to stb_image.c? + +If people submit them, I generally add them, but the goal of stb_image +is less for applications like image viewer apps (which need to support +every type of image under the sun) and more for things like games which +can choose what images to use, so I may decline to add them if they're +too rare or if the size of implementation vs. apparent benefit is too low. + +#### Are there other single-file public-domain libraries out there? + +Yes. I'll put a list here when people remind me what they are. + +#### 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? + +Because more people will use it. Because it's not viral, people +are not obligated to give back, so you could argue that it hurts +the *development* of it, and then because it doesn't develop as +well it's not as good, and then because it's not as good, in the +long run maybe fewer people will use it. I have total respect for +that opinion, but I just don't believe it myself for most software. + +#### 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. + + + diff --git a/tools/README.header.md b/tools/README.header.md new file mode 100644 index 0000000000000000000000000000000000000000..66871d20d51c74f120688c4260ece18d3538d4bc --- /dev/null +++ b/tools/README.header.md @@ -0,0 +1,7 @@ +stb +=== + +single-file public domain libraries for C/C++ + +library | lastest version | category | description +--------------------- | ---- | -------- | -------------------------------- diff --git a/tools/README.list b/tools/README.list new file mode 100644 index 0000000000000000000000000000000000000000..5436e74e3d1b957a3ab9af6911773187cc274dbe --- /dev/null +++ b/tools/README.list @@ -0,0 +1,10 @@ +stb_vorbis.c | audio | decode ogg vorbis files from file/memory to float/16-bit signed output +stb_image.c | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC +stb_truetype.h | graphics | parse, decode, and rasterize characters from truetype fonts +stb_image_write.h | graphics | image writing to disk: PNG, TGA, BMP +stb_textedit.h | UI | guts of a text editor for games etc implementing them from scratch +stb_dxt.h | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor +stb_perlin.h | 3D graphics | revised Perlin noise (3D input, 1D output) +stb_c_lexer.h | parsing | simplify writing parsers for C-like languages +stb_divide.h | math | more useful 32-bit modulus e.g. "euclidean divide" +stb.h | misc | helper functions for C, mostly redundant in C++; basically author's personal stuff diff --git a/tools/make_readme.c b/tools/make_readme.c new file mode 100644 index 0000000000000000000000000000000000000000..c327a0fd9b78f63e148d740e4c676578e9e08890 --- /dev/null +++ b/tools/make_readme.c @@ -0,0 +1,45 @@ +#define STB_DEFINE +#include "../stb.h" + +int main(int argc, char **argv) +{ + int i; + int hlen, flen, listlen; + char *header = stb_file("README.header.md", &hlen); + char *footer = stb_file("README.footer.md", &flen); + char **list = stb_stringfile("README.list", &listlen); + + FILE *f = fopen("../README.md", "wb"); + fwrite(header, 1, hlen, f); + + for (i=0; i < listlen; ++i) { + int num,j; + char **tokens = stb_tokens_stripwhite(list[i], "|", &num); + FILE *g = fopen(stb_sprintf("../%s", tokens[0]), "rb"); + char buffer[256], *s1, *s2; + fread(buffer, 1, 256, g); + fclose(g); + buffer[255] = 0; + s1 = strchr(buffer, '-'); + if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); + s2 = strchr(s1+2, '-'); + if (!s2) stb_fatal("Couldn't find '-' after version number in %s", tokens[0]); + *s2 = 0; + s1 += 1; + s1 = stb_trimwhite(s1); + if (*s1 == 'v') ++s1; + fprintf(f, "**%s** | %s", tokens[0], s1); + s1 = stb_trimwhite(tokens[1]); + s2 = stb_dupreplace(s1, " ", " "); + fprintf(f, " | %s", s2); + free(s2); + for (j=2; j < num; ++j) + fprintf(f, " | %s", tokens[j]); + fprintf(f, "\n"); + } + + fwrite(footer, 1, flen, f); + fclose(f); + + return 0; +} \ No newline at end of file diff --git a/tools/make_readme.dsp b/tools/make_readme.dsp new file mode 100644 index 0000000000000000000000000000000000000000..d235f3add334378ae83e717e077e217a643ea264 --- /dev/null +++ b/tools/make_readme.dsp @@ -0,0 +1,88 @@ +# Microsoft Developer Studio Project File - Name="make_readme" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=make_readme - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "make_readme.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "make_readme.mak" CFG="make_readme - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "make_readme - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "make_readme - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "make_readme - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "make_readme - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "make_readme - Win32 Release" +# Name "make_readme - Win32 Debug" +# Begin Source File + +SOURCE=.\make_readme.c +# End Source File +# End Target +# End Project diff --git a/tools/mr.bat b/tools/mr.bat new file mode 100644 index 0000000000000000000000000000000000000000..475bc4f4ff40706c85f397b4422dd6af2c58f88c --- /dev/null +++ b/tools/mr.bat @@ -0,0 +1 @@ +debug\make_readme