generate README.md in part by parsing libraries so that version numbers are in sync

pull/1/head
Sean Barrett 2014-05-30 14:15:51 -07:00
parent 9e566c8b31
commit fcfcb9bb3f
14 changed files with 244 additions and 20 deletions

View File

@ -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.33 | 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.92 | graphics | image writing to disk: PNG, TGA, BMP
**stb_textedit.h** | 1.1 | 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_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
FAQ
---

5
stb.h
View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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>

View File

@ -65,7 +65,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /GX /Zd /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /GX /Zd /Od /I ".." /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

65
tools/README.footer.md Normal file
View File

@ -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/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.

7
tools/README.header.md Normal file
View File

@ -0,0 +1,7 @@
stb
===
single-file public domain libraries for C/C++
library | lastest version | category | description
--------------------- | ---- | -------- | --------------------------------

10
tools/README.list Normal file
View File

@ -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

45
tools/make_readme.c Normal file
View File

@ -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, " ", "&nbsp;");
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;
}

88
tools/make_readme.dsp Normal file
View File

@ -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