瀏覽代碼

Update version numbers

Sean Barrett 6 年之前
父節點
當前提交
787f1d646a
共有 11 個文件被更改,包括 178 次插入22 次删除
  1. 19 10
      README.md
  2. 3 1
      stb.h
  3. 2 1
      stb_c_lexer.h
  4. 1 1
      stb_ds.h
  5. 2 1
      stb_image.h
  6. 4 2
      stb_image_write.h
  7. 4 4
      stb_truetype.h
  8. 2 2
      tests/stb.dsp
  9. 8 0
      tools/README.header.md
  10. 1 0
      tools/README.list
  11. 132 0
      tools/build_matrix.c

+ 19 - 10
README.md

@@ -5,36 +5,45 @@ stb
 
 single-file public domain (or MIT licensed) libraries for C/C++ <a name="stb_libs"></a>
 
+Noteworthy:
+
+* image loader: <a href="/nothings/stb/blob/master/stb_image.h">stb_image.h</a>
+* image writer: <a href="/nothings/stb/blob/master/stb_image_write.h">stb_image_write.h</a>
+* image resizer: <a href="/nothings/stb/blob/master/stb_image_resize.h">stb_image_resize.h></a>
+* font text rasterizer: <a href="/nothings/stb/blob/master/stb_truetype.h">stb_truetype.h</a>
+* typesafe containers: <a href="/nothings/stb/blob/master/stb_ds.h">stb_ds.h</a>
+
 Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
 by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
 
 
 library    | lastest version | category | LoC | description
 --------------------- | ---- | -------- | --- | --------------------------------
-**[stb_vorbis.c](stb_vorbis.c)** | 1.17 | audio | 5486 | decode ogg vorbis files from file/memory to float/16-bit signed output
-**[stb_image.h](stb_image.h)** | 2.22 | graphics | 7547 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
-**[stb_truetype.h](stb_truetype.h)** | 1.21 | graphics | 4882 | parse, decode, and rasterize characters from truetype fonts
-**[stb_image_write.h](stb_image_write.h)** | 1.13 | graphics | 1617 | image writing to disk: PNG, TGA, BMP
+**[stb_vorbis.c](stb_vorbis.c)** | 1.17 | audio | 5502 | decode ogg vorbis files from file/memory to float/16-bit signed output
+**[stb_image.h](stb_image.h)** | 2.23 | graphics | 7559 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
+**[stb_truetype.h](stb_truetype.h)** | 1.22 | graphics | 4888 | parse, decode, and rasterize characters from truetype fonts
+**[stb_image_write.h](stb_image_write.h)** | 1.13 | graphics | 1619 | image writing to disk: PNG, TGA, BMP
 **[stb_image_resize.h](stb_image_resize.h)** | 0.96 | graphics | 2630 | resize images larger/smaller with good quality
 **[stb_rect_pack.h](stb_rect_pack.h)** | 1.00 | graphics | 628 | simple 2D rectangle packer with decent quality
-**[stb_ds.h](stb_ds.h)** | 0.5 | utility | 1691 | typesafe dynamic array and hash tables for C, will compile in C++
+**[stb_ds.h](stb_ds.h)** | 0.6 | utility | 1699 | typesafe dynamic array and hash tables for C, will compile in C++
 **[stb_sprintf.h](stb_sprintf.h)** | 1.06 | utility | 1860 | fast sprintf, snprintf for C/C++
 **[stretchy_buffer.h](stretchy_buffer.h)** | 1.03 | utility | 262 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
 **[stb_textedit.h](stb_textedit.h)** | 1.13 | user&nbsp;interface | 1404 | guts of a text editor for games etc implementing them from scratch
 **[stb_voxel_render.h](stb_voxel_render.h)** | 0.88 | 3D&nbsp;graphics | 3806 | Minecraft-esque voxel rendering "engine" with many more features
 **[stb_dxt.h](stb_dxt.h)** | 1.08b | 3D&nbsp;graphics | 728 | Fabian "ryg" Giesen's real-time DXT compressor
-**[stb_perlin.h](stb_perlin.h)** | 0.4 | 3D&nbsp;graphics | 366 | revised Perlin noise (3D input, 1D output)
+**[stb_perlin.h](stb_perlin.h)** | 0.4 | 3D&nbsp;graphics | 427 | revised Perlin noise (3D input, 1D output)
 **[stb_easy_font.h](stb_easy_font.h)** | 1.0 | 3D&nbsp;graphics | 303 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
 **[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.41 | game&nbsp;dev | 4161 | 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.10 | parsing | 964 | simplify writing parsers for C-like languages
+**[stb_c_lexer.h](stb_c_lexer.h)** | 0.11 | parsing | 966 | simplify writing parsers for C-like languages
 **[stb_divide.h](stb_divide.h)** | 0.92 | math | 421 | 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.h](stb.h)** | 2.34 | misc | 14453 | helper functions for C, mostly redundant in C++; basically author's personal stuff
+**[stb.h](stb.h)** | 2.35 | misc | 14453 | helper functions for C, mostly redundant in C++; basically author's personal stuff
 **[stb_leakcheck.h](stb_leakcheck.h)** | 0.5 | misc | 190 | quick-and-dirty malloc/free leak-checking
+**[stb_include.h](stb_include.h)** | 0.01 | misc | 288 | implement recursive #include support, particularly for GLSL
 
-Total libraries: 21  
-Total lines of C code: 55669
+Total libraries: 22  
+Total lines of C code: 56064
 
 
 FAQ

+ 3 - 1
stb.h

@@ -1,4 +1,4 @@
-/* stb.h - v2.34 - Sean's Tool Box -- public domain -- http://nothings.org/stb.h
+/* stb.h - v2.35 - 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
@@ -25,6 +25,7 @@
 
 Version History
 
+   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
@@ -7150,6 +7151,7 @@ static void stb__dirtree_scandir(char *path, time_t last_time, stb_dirtree *acti
    // @TODO: do this concatenation without using swprintf to avoid this mess:
 #if (defined(_MSC_VER) && _MSC_VER < 1400) // || (defined(__clang__))
    // confusingly, Windows Kits\10 needs to go down this path?!?
+   // except now it doesn't, I don't know what changed
    if (has_slash)
       swprintf(full_path, L"%s*", stb__from_utf8(path));
    else

+ 2 - 1
stb_c_lexer.h

@@ -1,4 +1,4 @@
-// stb_c_lexer.h - v0.10 - public domain Sean Barrett 2013
+// stb_c_lexer.h - v0.11 - 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.
@@ -10,6 +10,7 @@
 // suffixes on integer constants are not handled (you can override this).
 //
 // History:
+//     0.11 fix clang static analysis warning
 //     0.10 fix warnings
 //     0.09 hex floats, no-stdlib fixes
 //     0.08 fix bad pointer comparison

+ 1 - 1
stb_ds.h

@@ -1,4 +1,4 @@
-/* stb_ds.h - v0.5 - public domain data structures - Sean Barrett 2019
+/* stb_ds.h - v0.6 - public domain data structures - Sean Barrett 2019
   
    This is a single-header-file library that provides easy-to-use
    dynamic arrays and hash tables for C (also works in C++).

+ 2 - 1
stb_image.h

@@ -1,4 +1,4 @@
-/* stb_image - v2.22 - public domain image loader - http://nothings.org/stb
+/* stb_image - v2.23 - public domain image loader - http://nothings.org/stb
                                   no warranty implied; use at your own risk
 
    Do this:
@@ -48,6 +48,7 @@ LICENSE
 
 RECENT REVISION HISTORY:
 
+      2.23  (2019-08-11) fix clang static analysis warning
       2.22  (2019-03-04) gif fixes, fix warnings
       2.21  (2019-02-25) fix typo in comment
       2.20  (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs 

+ 4 - 2
stb_image_write.h

@@ -1,4 +1,4 @@
-/* stb_image_write - v1.13 - public domain - http://nothings.org/stb/stb_image_write.h
+/* stb_image_write - v1.13 - public domain - http://nothings.org/stb
    writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
                                      no warranty implied; use at your own risk
 
@@ -868,7 +868,7 @@ STBIWDEF unsigned char * stbi_zlib_compress(unsigned char *data, int data_len, i
    unsigned int bitbuf=0;
    int i,j, bitcount=0;
    unsigned char *out = NULL;
-   unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(char**));
+   unsigned char ***hash_table = (unsigned char***) STBIW_MALLOC(stbiw__ZHASH * sizeof(unsigned char**));
    if (hash_table == NULL)
       return NULL;
    if (quality < 5) quality = 5;
@@ -1530,6 +1530,8 @@ STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const
 #endif // STB_IMAGE_WRITE_IMPLEMENTATION
 
 /* Revision history
+      1.11  (2019-08-11)
+             
       1.10  (2019-02-07)
              support utf8 filenames in Windows; fix warnings and platform ifdefs 
       1.09  (2018-02-11)

+ 4 - 4
stb_truetype.h

@@ -1,5 +1,5 @@
-// stb_truetype.h - v1.21 - public domain
-// authored from 2009-2016 by Sean Barrett / RAD Game Tools
+// stb_truetype.h - v1.22 - public domain
+// authored from 2009-2019 by Sean Barrett / RAD Game Tools
 //
 //   This library processes TrueType files:
 //        parse files
@@ -50,6 +50,7 @@
 //       
 // VERSION HISTORY
 //
+//   1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined 
 //   1.21 (2019-02-25) fix warning
 //   1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics()
 //   1.19 (2018-02-11) GPOS kerning, STBTT_fmod
@@ -2541,8 +2542,7 @@ STBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int
 
    if (info->gpos)
       xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2);
-
-   if (info->kern)
+   else if (info->kern)
       xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2);
 
    return xAdvance;

+ 2 - 2
tests/stb.dsp

@@ -42,7 +42,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /G6 /MT /W3 /GX /Z7 /O2 /Ob2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GRID_TEST" /FD /c
+# ADD CPP /nologo /G6 /MT /W3 /GX /Z7 /O2 /Ob2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "VORBIS_TEST" /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -66,7 +66,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 /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DS_TEST" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "VORBIS_TEST" /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"

+ 8 - 0
tools/README.header.md

@@ -3,6 +3,14 @@ stb
 
 single-file public domain (or MIT licensed) libraries for C/C++ <a name="stb_libs"></a>
 
+Noteworthy:
+
+* image loader: <a href="/nothings/stb/blob/master/stb_image.h">stb_image.h</a>
+* image writer: <a href="/nothings/stb/blob/master/stb_image_write.h">stb_image_write.h</a>
+* image resizer: <a href="/nothings/stb/blob/master/stb_image_resize.h">stb_image_resize.h></a>
+* font text rasterizer: <a href="/nothings/stb/blob/master/stb_truetype.h">stb_truetype.h</a>
+* typesafe containers: <a href="/nothings/stb/blob/master/stb_ds.h">stb_ds.h</a>
+
 Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
 by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
 

+ 1 - 0
tools/README.list

@@ -19,3 +19,4 @@ stb_divide.h                | math             | more useful 32-bit modulus e.g.
 stb_connected_components.h  | misc             | incrementally compute reachability on grids
 stb.h                       | misc             | helper functions for C, mostly redundant in C++; basically author's personal stuff
 stb_leakcheck.h             | misc             | quick-and-dirty malloc/free leak-checking
+stb_include.h               | misc             | implement recursive #include support, particularly for GLSL

+ 132 - 0
tools/build_matrix.c

@@ -0,0 +1,132 @@
+#define STB_DEFINE
+#include "stb.h"
+
+// true if no error
+int run_command(char *batch_file, char *command)
+{
+   char buffer[4096];
+   if (batch_file[0]) {
+      sprintf(buffer, "%s && %s", batch_file, command);
+      return system(buffer) == 0;
+   } else {
+      return system(command) == 0;
+   }
+}
+
+typedef struct
+{
+   char *compiler_name;
+   char *batchfile;
+   char *objdir;
+   char *compiler;
+   char *args;
+   char *link;
+} compiler_info;
+
+compiler_info *compilers;
+char *shared_args;
+char *shared_link;
+
+typedef struct
+{
+   char *filelist;
+} project_info;
+
+project_info *projects;
+
+enum { NONE, IN_COMPILERS, IN_ARGS, IN_PROJECTS, IN_LINK };
+
+int main(int argc, char **argv)
+{
+   int state = NONE;
+   int i,j,n;
+   char **line;
+   if (argc != 2) stb_fatal("Usage: stb_build_matrix {build-file}\n");
+   line = stb_stringfile(argv[1], &n);
+   if (line == 0) stb_fatal("Couldn't open file '%s'\n", argv[1]);
+
+   for (i=0; i < n; ++i) {
+      char *p = stb_trimwhite(line[i]);
+      if (p[0] == 0) continue;
+      else if (p[0] == '#') continue;
+      else if (0 == stricmp(p, "[compilers]")) { state = IN_COMPILERS;                     }
+      else if (0 == stricmp(p, "[args]"     )) { state = IN_ARGS     ; shared_args = NULL; }
+      else if (0 == stricmp(p, "[projects]" )) { state = IN_PROJECTS ;                     }
+      else if (0 == stricmp(p, "[link]"     )) { state = IN_LINK     ; shared_link = NULL; }
+      else {
+         switch (state) {
+            case NONE: stb_fatal("Invalid text outside section at line %d.", i+1);
+            case IN_COMPILERS: {
+               char buffer[4096];
+               int count;
+               compiler_info ci;
+               char **tokens = stb_tokens_stripwhite(p, ",", &count), *batch;
+               if (count > 3) stb_fatal("Expecting name and batch file name at line %d.", i+1);
+               batch = (count==1 ? tokens[0] : tokens[1]);
+               if (strlen(batch)) 
+                  sprintf(buffer, "c:\\%s.bat", batch);
+               else
+                  strcpy(buffer, "");
+               ci.compiler_name = strdup(tokens[0]);
+               ci.batchfile     = strdup(buffer);
+               ci.compiler      = count==3 ? strdup(tokens[2]) : "cl";
+               if (0==strnicmp(batch, "vcvars_", 7))
+                  ci.objdir     = strdup(stb_sprintf("%s_%d", batch+7, i));
+               else
+                  ci.objdir     = strdup(stb_sprintf("%s_%d", batch, i));
+               ci.args = shared_args;
+               ci.link = shared_link;
+               stb_arr_push(compilers, ci);
+               break;
+            }
+            case IN_ARGS: {
+               stb_arr_push(shared_args, ' ');
+               for (j=0; p[j] != 0; ++j)
+                  stb_arr_push(shared_args, p[j]);
+               break;
+            }
+            case IN_LINK: {
+               stb_arr_push(shared_link, ' ');
+               for (j=0; p[j] != 0; ++j)
+                  stb_arr_push(shared_link, p[j]);
+               break;
+            }
+            case IN_PROJECTS: {
+               project_info pi;
+               pi.filelist = strdup(p);
+               stb_arr_push(projects, pi);
+               break;
+            }
+         }
+      }
+   }
+
+   _mkdir("obj");
+   for (j=0; j < stb_arr_len(compilers); ++j) {
+      char command[4096];
+      for (i=0; i < stb_arr_len(projects); ++i) {
+         int r;
+         _mkdir(stb_sprintf("obj/%s", compilers[j].objdir));
+         if (stb_suffix(compilers[j].compiler, "cl"))
+            sprintf(command, "%s %.*s %s /link %.*s",
+                                     compilers[j].compiler,
+                                     stb_arr_len(compilers[j].args), compilers[j].args,
+                                     projects[i].filelist,
+                                     stb_arr_len(compilers[j].link), compilers[j].link);
+         else
+            sprintf(command, "%s %.*s %s %.*s",
+                                     compilers[j].compiler,
+                                     stb_arr_len(compilers[j].args), compilers[j].args,
+                                     projects[i].filelist,
+                                     stb_arr_len(compilers[j].link), compilers[j].link);
+         r = run_command(compilers[j].batchfile, command);
+         stbprint("{%c== Compiler %s == Building %s}\n", r ? '$' : '!', compilers[j].compiler_name, projects[i].filelist);
+         system("if EXIST *.obj del /q *.obj");
+         system("if EXIST *.o del /q *.o");
+         if (!r)
+            return 1;
+      }
+   }
+
+   return 0;
+}