From 4a7a434c2d059513aeba1afc0142bef6bd9db8ea Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sat, 1 Feb 2020 04:21:41 -0800 Subject: [PATCH] various tests and infrastructure fixes --- tests/stb.dsp | 6 +++++- tests/stb_cpp.cpp | 2 ++ tests/test_c_compilation.c | 12 ++++++++++-- tests/test_ds.c | 3 ++- tools/README.footer.md | 9 ++++----- tools/README.header.md | 13 +++++++------ tools/build_matrix.c | 7 ++++++- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/tests/stb.dsp b/tests/stb.dsp index ece606e..018519f 100644 --- a/tests/stb.dsp +++ b/tests/stb.dsp @@ -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 "VORBIS_TEST" /FR /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 # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -226,6 +226,10 @@ SOURCE=.\test_image_write.c # End Source File # Begin Source File +SOURCE=.\test_packer.c +# End Source File +# Begin Source File + SOURCE=.\test_perlin.c # End Source File # Begin Source File diff --git a/tests/stb_cpp.cpp b/tests/stb_cpp.cpp index 9cd6670..65373a9 100644 --- a/tests/stb_cpp.cpp +++ b/tests/stb_cpp.cpp @@ -52,6 +52,7 @@ void test_lex(void) int main(int argc, char **argv) { +#if 0 char *p; p = (char*) "abcdefghijklmnopqrstuvwxyz"; c(stb_ischar('c', p), "stb_ischar 1"); @@ -73,6 +74,7 @@ int main(int argc, char **argv) c(stb_ischar('x', p), "stb_ischar f"); c(!stb_ischar('#', p), "stb_ischar g"); c(stb_ischar('X', p), "stb_ischar h"); +#endif test_lex(); diff --git a/tests/test_c_compilation.c b/tests/test_c_compilation.c index c3f082a..9b4d504 100644 --- a/tests/test_c_compilation.c +++ b/tests/test_c_compilation.c @@ -28,8 +28,16 @@ #define STBVOX_CONFIG_MODE 1 #include "stb_voxel_render.h" -#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 0 -#define STBTE_DRAW_TILE(x,y,id,highlight,data) 0 +void STBTE_DRAW_RECT(int x0, int y0, int x1, int y1, unsigned int color) +{ +} + + + +void STBTE_DRAW_TILE(int x0, int y0, unsigned short id, int highlight, float *data) +{ +} + #define STB_TILEMAP_EDITOR_IMPLEMENTATION #include "stb_tilemap_editor.h" diff --git a/tests/test_ds.c b/tests/test_ds.c index b51e8f4..896dcda 100644 --- a/tests/test_ds.c +++ b/tests/test_ds.c @@ -9,12 +9,13 @@ //#define STBDS_INTERNAL_BUCKET_START // don't bother offseting differently within bucket for different hash values //#define STBDS_FLUSH_CACHE (1u<<20) // do this much memory traffic to flush the cache between some benchmarking measurements +#include + #define WIN32_LEAN_AND_MEAN #include #define STB_DEFINE #define STB_NO_REGISTRY #include "../stb.h" -#include #endif #ifdef DS_TEST diff --git a/tools/README.footer.md b/tools/README.footer.md index f6f4bf5..f2f8f7e 100644 --- a/tools/README.footer.md +++ b/tools/README.footer.md @@ -91,11 +91,10 @@ way 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_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. +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? diff --git a/tools/README.header.md b/tools/README.header.md index 65dc95e..03fa1c5 100644 --- a/tools/README.header.md +++ b/tools/README.header.md @@ -1,19 +1,20 @@ stb === -single-file public domain (or MIT licensed) libraries for C/C++ +single-file public domain (or MIT licensed) libraries for C/C++ Noteworthy: -* image loader: stb_image.h -* image writer: stb_image_write.h -* image resizer: stb_image_resize.h> -* font text rasterizer: stb_truetype.h -* typesafe containers: stb_ds.h +* 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_resize by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts. + library | lastest version | category | LoC | description --------------------- | ---- | -------- | --- | -------------------------------- diff --git a/tools/build_matrix.c b/tools/build_matrix.c index fab6b38..4051020 100644 --- a/tools/build_matrix.c +++ b/tools/build_matrix.c @@ -71,7 +71,7 @@ int main(int argc, char **argv) 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)); + ci.objdir = strdup(stb_sprintf("vs_%s_%d", batch+7, i)); else ci.objdir = strdup(stb_sprintf("%s_%d", batch, i)); ci.args = shared_args; @@ -121,6 +121,11 @@ int main(int argc, char **argv) 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); + stb_copyfile("a.exe", stb_sprintf("obj/%s/a.exe", compilers[j].objdir)); + //printf("Copy: %s to %s\n", "a.exe", stb_sprintf("obj/%s/a.exe", compilers[j].objdir)); + stb_copyfile("temp.exe", stb_sprintf("obj/%s/temp.exe", compilers[j].objdir)); + system("if EXIST a.exe del /q a.exe"); + system("if EXIST temp.exe del /q temp.exe"); system("if EXIST *.obj del /q *.obj"); system("if EXIST *.o del /q *.o"); if (!r)