various tests and infrastructure fixes
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parent c440a53 · Browse files · 7 files·+36 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+36 added−16 removed
- tests:+19 added−4 removed
- other:+17 added−12 removed
Provenance
- Commit
4a7a434- Tree
0e3b503- Author
Sean Barrett <sean@nothings.org>- Committer
Sean Barrett <sean@nothings.org>- Parent
c440a53
7 files changed+36 added−16 removed
modified:tests/stb_cpp.cpp+2 added
50 unmodified lines51 }52 53 int main(int argc, char **argv)54 {55+#if 056 char *p;57 p = (char*) "abcdefghijklmnopqrstuvwxyz";58 c(stb_ischar('c', p), "stb_ischar 1");59 c(stb_ischar('x', p), "stb_ischar 2");13 unmodified lines73 c(!stb_ischar('c', p), "stb_ischar e");74 c(stb_ischar('x', p), "stb_ischar f");75 c(!stb_ischar('#', p), "stb_ischar g");76 c(stb_ischar('X', p), "stb_ischar h");77+#endif78 79 test_lex();80 81 if (count) {4 unmodified linesmodified:tests/stb.dsp+5 added-1 removed
64 unmodified lines65 # PROP Intermediate_Dir "Debug\stb"66 # PROP Ignore_Export_Lib 067 # PROP Target_Dir ""68 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c69-# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "VORBIS_TEST" /FR /FD /GZ /c69+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DS_TEST" /FR /FD /GZ /c70 # SUBTRACT CPP /YX71 # ADD BASE RSC /l 0x409 /d "_DEBUG"72 # ADD RSC /l 0x409 /d "_DEBUG"73 BSC32=bscmake.exe151 unmodified lines225 SOURCE=.\test_image_write.c226 # End Source File227 # Begin Source File228 229+SOURCE=.\test_packer.c230+# End Source File231+# Begin Source File232+233 SOURCE=.\test_perlin.c234 # End Source File235 # Begin Source File236 20 unmodified linesmodified:tests/test_c_compilation.c+10 added-2 removed
26 unmodified lines27 28 #define STBVOX_CONFIG_MODE 129 #include "stb_voxel_render.h"30 31-#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 032-#define STBTE_DRAW_TILE(x,y,id,highlight,data) 031+void STBTE_DRAW_RECT(int x0, int y0, int x1, int y1, unsigned int color)32+{33+}34+35+36+37+void STBTE_DRAW_TILE(int x0, int y0, unsigned short id, int highlight, float *data)38+{39+}40+41 #define STB_TILEMAP_EDITOR_IMPLEMENTATION42 #include "stb_tilemap_editor.h"43 44 6 unmodified linesmodified:tests/test_ds.c+2 added-1 removed
7 unmodified lines8 //#define STBDS_SIPHASH_2_4 // performance test 1_3 against 2_49 //#define STBDS_INTERNAL_BUCKET_START // don't bother offseting differently within bucket for different hash values10 //#define STBDS_FLUSH_CACHE (1u<<20) // do this much memory traffic to flush the cache between some benchmarking measurements11 12+#include <stdio.h>13+14 #define WIN32_LEAN_AND_MEAN15 #include <windows.h>16 #define STB_DEFINE17 #define STB_NO_REGISTRY18 #include "../stb.h"17-#include <stdio.h>19 #endif20 21 #ifdef DS_TEST22 #define STBDS_UNIT_TESTS1009 unmodified linesmodified:tools/build_matrix.c+6 added-1 removed
69 unmodified lines70 ci.compiler_name = strdup(tokens[0]);71 ci.batchfile = strdup(buffer);72 ci.compiler = count==3 ? strdup(tokens[2]) : "cl";73 if (0==strnicmp(batch, "vcvars_", 7))74- ci.objdir = strdup(stb_sprintf("%s_%d", batch+7, i));74+ ci.objdir = strdup(stb_sprintf("vs_%s_%d", batch+7, i));75 else76 ci.objdir = strdup(stb_sprintf("%s_%d", batch, i));77 ci.args = shared_args;78 ci.link = shared_link;41 unmodified lines120 projects[i].filelist,121 stb_arr_len(compilers[j].link), compilers[j].link);122 r = run_command(compilers[j].batchfile, command);123 stbprint("{%c== Compiler %s == Building %s}\n", r ? '$' : '!', compilers[j].compiler_name, projects[i].filelist);124+ stb_copyfile("a.exe", stb_sprintf("obj/%s/a.exe", compilers[j].objdir));125+ //printf("Copy: %s to %s\n", "a.exe", stb_sprintf("obj/%s/a.exe", compilers[j].objdir));126+ stb_copyfile("temp.exe", stb_sprintf("obj/%s/temp.exe", compilers[j].objdir));127+ system("if EXIST a.exe del /q a.exe");128+ system("if EXIST temp.exe del /q temp.exe");129 system("if EXIST *.obj del /q *.obj");130 system("if EXIST *.o del /q *.o");131 if (!r)132 return 1;5 unmodified linesmodified:tools/README.footer.md+4 added-5 removed
89 unmodified lines90919293949596979894959697989910010119 unmodified lines89 unmodified linesway of namespacing the filenames and source function names.
#### Will you add more image types to stb_image.h?
If people submit them, I generally add them, but the goal of stb_imageis less for applications like image viewer apps (which need to supportevery type of image under the sun) and more for things like games whichcan choose what images to use, so I may decline to add them if they'retoo rare or if the size of implementation vs. apparent benefit is too low.No. As stb_image use has grown, it has become more importantfor us to focus on security of the codebase. Adding new imageformats increases the amount of code we need to secure, so itis 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.txt19 unmodified linesmodified:tools/README.header.md+7 added-6 removed
1234456789101112891011121314151617181920stb===
single-file public domain (or MIT licensed) libraries for C/C++ <a name="stb_libs"></a>single-file public domain (or MIT licensed) libraries for C/C++
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>* image loader: [stb_image.h](stb_image.h)* image writer: [stb_image_write.h](stb_image_write.h)* image resizer: [stb_image_resize.h](stb_image_resize.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, stb_image_resizeby Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
<a name="stb_libs"></a>
library | lastest version | category | LoC | description--------------------- | ---- | -------- | --- | --------------------------------