Fix issue #62: emit stdlib code as char array, not a string

MSVC 2010 issues an error if given a string larger than 64k characters
long.  To work around this, the pre-processed stdlib.ispc code is now
stored as an array of characters terminated with a NUL (i.e. the same thing
in the end); MSVC is fine with arrays larger than 64k characters.
This commit is contained in:
Matt Pharr
2011-07-08 09:14:52 -07:00
parent 7058ca1aaf
commit 6e8af5038b
2 changed files with 8 additions and 7 deletions

View File

@@ -625,7 +625,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
// If the user wants the standard library to be included, parse the
// serialized version of the stdlib.ispc file to get its definitions
// added.
extern const char *stdlib_code;
extern char stdlib_code[];
yy_scan_string(stdlib_code);
yyparse();
}

View File

@@ -2,10 +2,11 @@
import sys
print "const char *stdlib_code = "
for line in sys.stdin:
l=line.rstrip()
l=l.replace('"', '\\"')
print "\"" + l + "\\n\""
print "char stdlib_code[] = { "
print ";"
for line in sys.stdin:
for c in line:
print ord(c)
print ", "
print "0 };"