- size_t size;
-
- printf("Total Size: "); fflush(stdout);
- size = AST_WriteScript(NULL, ret->Script);
- printf("0x%x bytes\n", (unsigned)size);
-
- fp = fopen(cacheFilename, "wb");
- if(!fp) return ret;
-
- data = malloc(size);
- size = AST_WriteScript(data, ret->Script);
- fwrite(data, size, 1, fp);
- free(data);
- fclose(fp);
+ char cacheFilename[strlen(Filename)+6+1];
+ strcpy(cacheFilename, Filename);
+ strcat(cacheFilename, ".ast");
+
+ SpiderScript_SaveAST(ret, cacheFilename);
+ }
+ #endif
+ // - Save Bytecode too
+ {
+ char cacheFilename[strlen(Filename)+6+1];
+ strcpy(cacheFilename, Filename);
+ strcat(cacheFilename, ".bc");
+
+ SpiderScript_SaveBytecode(ret, cacheFilename);