diff --git a/CHANGES b/CHANGES index 97c58ed..b28109f 100644 --- a/CHANGES +++ b/CHANGES @@ -3,10 +3,22 @@ Release v0.3.0 - Return assignments, the ability to assign to the return keyword as if it were a local variable. - Added bitwise XOR operator (^) + - Array initializers: e.g float a[] = {1, 2, 3}; + - Fix bug that dissalowed language operators to be used in strings. * Compilation: - Optimized memory usage (now uses on average %3 less memory for compilation). - Fixed dotranslate (translatable strings) + - Rewrote constant folding optimization pass for the parser. + - New additional dead-code-elimination-consatant-fold pass for + if statements whos expression can be evaluated at compile-time + (allowing the if/else branch to be entierly elided at compile-time). + - Added support for columns in error diagnostics. + - Limit corrector to <= 16 byte strings. + - Improved hash function for hashtable (old hash function had 15% error, + this speeds up compilation) + - Improved performance of in-house allocator with branch-hinting, speeds + up compilation of Xonotic by 3 seconds! * QCVM: - Escape strings for -printdefs * Commandline: @@ -14,13 +26,23 @@ Release v0.3.0 hashtables, vectors, and number of unique sizes of vectors and hashtables. The amount of memory used for vectors. As well as the number of strdups used in total for compilation. + - Added compile statistic dumps, gives information about the compiled + binary, and LNO, such as the size, CRC, the number of times a + specific optimization was applied, etc. + - Make -std=qcc default * Testsuite: - Fixed a floating point exception rasied by modulo operation in -memchk. + - Added support for the test-suite to source tests and task-template + files from subdirectories in the test/ directory. * Build: - - Added gentoo ebuilds. - - Added win32 Makefile for building win32 packages. - - Added slackware pkg build files + - Can now be compile with TCC (Tiny C compiler) and function as + intended (previously couldn't due to bug in TCC codegen). + - Added Gentoo ebuilds. + - Added Win32 Makefile for building Win32 packages. + - Added Slackware pkg build files. + - Added Fedora spec files. + - Added Makefile for the BSD make variant. 2012-04-27 v0.2.9 * Preprocessor: @@ -75,6 +97,9 @@ Release v0.3.0 - Added support for preprocessor tests - Added preprocessor tests - Added defs.qh (auto included) for qcvm definitions + - Now prints the number of failed tests (if any) after all tests + are attempted. + - Fixed some bugs with error handling resulting in false-positives. * Syntax Highlighting: - Added various syntax highlighting description files for various text editors / integrated development envirorments, diff --git a/exec.c b/exec.c index 33037dc..81c2361 100644 --- a/exec.c +++ b/exec.c @@ -904,32 +904,6 @@ static void prog_main_setparams(qc_program_t *prog) { } } -static void escapestring(char* dest, const char* src) { - char c; - while ((c = *(src++))) { - switch(c) { - case '\t': - *(dest++) = '\\', *(dest++) = 't'; - break; - case '\n': - *(dest++) = '\\', *(dest++) = 'n'; - break; - case '\r': - *(dest++) = '\\', *(dest++) = 'r'; - break; - case '\\': - *(dest++) = '\\', *(dest++) = '\\'; - break; - case '\"': - *(dest++) = '\\', *(dest++) = '\"'; - break; - default: - *(dest++) = c; - } - } - *dest = '\0'; -} - void prog_disasm_function(qc_program_t *prog, size_t id); int main(int argc, char **argv) { @@ -1146,9 +1120,7 @@ int main(int argc, char **argv) { return 0; } if (opts_printdefs) { - char *escape = NULL; const char *getstring = NULL; - for (i = 0; i < vec_size(prog->defs); ++i) { printf("Global: %8s %-16s at %u%s", type_name[prog->defs[i].type & DEF_TYPEMASK], @@ -1171,11 +1143,9 @@ int main(int argc, char **argv) { break; case TYPE_STRING: getstring = prog_getstring(prog, ((qcany_t*)(prog->globals + prog->defs[i].offset))->string); - escape = (char*)mem_a(strlen(getstring) * 2 + 1); /* will be enough */ - escapestring(escape, getstring); - printf(" [init: `%s`]", escape); - - mem_d(escape); /* free */ + printf(" [init: `"); + print_escaped_string(getstring, strlen(getstring)); + printf("`]\n"); break; default: break; diff --git a/gmqcc.h b/gmqcc.h index 3f960b8..fcf7d83 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -157,6 +157,8 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \ # define GMQCC_UNLIKELY(X) (X) #endif +#define GMQCC_ARRAY_COUNT(X) (sizeof(X) / sizeof((X)[0])) + #ifndef _MSC_VER # include #else