add "lines of code" to README.md
This commit is contained in:
@ -20,6 +20,17 @@ 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 do you list "lines of code"? It's a terrible metric.
|
||||
|
||||
Just to give you some idea of the internal complexity of the library,
|
||||
to help you manage your expectations, or to let you know what you're
|
||||
getting into. While not all the libraries are written in the same
|
||||
style, they're certainly similar styles, and so comparisons between
|
||||
the libraries are probably still meaningful.
|
||||
|
||||
Note though that the lines do include both the implementation, the
|
||||
part that corresponds to a header file, and the documentation.
|
||||
|
||||
#### Why single-file headers?
|
||||
|
||||
Windows doesn't have standard directories where libraries
|
||||
|
@ -3,5 +3,5 @@ stb
|
||||
|
||||
single-file public domain libraries for C/C++
|
||||
|
||||
library | lastest version | category | description
|
||||
--------------------- | ---- | -------- | --------------------------------
|
||||
library | lastest version | Lines Of Code | category | description
|
||||
--------------------- | ---- | --------------| -------- | --------------------------------
|
||||
|
@ -15,12 +15,10 @@ int main(int argc, char **argv)
|
||||
for (i=0; i < listlen; ++i) {
|
||||
int num,j;
|
||||
char **tokens = stb_tokens_stripwhite(list[i], "|", &num); // stb_tokens -- tokenize string into malloced array of strings
|
||||
FILE *g = fopen(stb_sprintf("../%s", tokens[0]), "rb"); // stb_sprintf -- sprintf to a static temp buffer (not threadsafe or secure)
|
||||
char buffer[256], *s1, *s2;
|
||||
fread(buffer, 1, 256, g);
|
||||
fclose(g);
|
||||
buffer[255] = 0;
|
||||
s1 = strchr(buffer, '-');
|
||||
int num_lines;
|
||||
char **lines = stb_stringfile(stb_sprintf("../%s", tokens[0]), &num_lines);
|
||||
char *s1, *s2;
|
||||
s1 = strchr(lines[0], '-');
|
||||
if (!s1) stb_fatal("Couldn't find '-' before version number in %s", tokens[0]); // stb_fatal -- print error message & exit
|
||||
s2 = strchr(s1+2, '-');
|
||||
if (!s2) stb_fatal("Couldn't find '-' after version number in %s", tokens[0]); // stb_fatal -- print error message & exit
|
||||
@ -33,6 +31,7 @@ int main(int argc, char **argv)
|
||||
s2 = stb_dupreplace(s1, " ", " "); // stb_dupreplace -- search & replace string and malloc result
|
||||
fprintf(f, " | %s", s2);
|
||||
free(s2);
|
||||
fprintf(f, " | %d", num_lines);
|
||||
for (j=2; j < num; ++j)
|
||||
fprintf(f, " | %s", tokens[j]);
|
||||
fprintf(f, "\n");
|
||||
|
Reference in New Issue
Block a user