Переглянути джерело

various tests and infrastructure fixes

Sean Barrett 5 роки тому
батько
коміт
4a7a434c2d

+ 5 - 1
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

+ 2 - 0
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();
 

+ 10 - 2
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"
 

+ 2 - 1
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 <stdio.h>
+
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #define STB_DEFINE
 #define STB_NO_REGISTRY
 #include "../stb.h"
-#include <stdio.h>
 #endif
 
 #ifdef DS_TEST

+ 4 - 5
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?
 

+ 7 - 6
tools/README.header.md

@@ -1,19 +1,20 @@
 stb
 ===
 
-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_resize
 by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
 
+<a name="stb_libs"></a>
 
 library    | lastest version | category | LoC | description
 --------------------- | ---- | -------- | --- | --------------------------------

+ 6 - 1
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)