void TK_OpenSource(char *fileName) { int size; TK_CloseSource(); size = MS_LoadFile(fileName, &FileStart); tk_SourceName = AddFileName(fileName); SetLocalIncludePath(fileName); SourceOpen = TRUE; FileEnd = FileStart+size; FilePtr = FileStart; tk_Line = 1; tk_Token = TK_NONE; AlreadyGot = FALSE; NestDepth = 0; NextChr(); }
int main(int argc, char **argv) { int i; ArgCount = argc; ArgVector = argv; DisplayBanner(); Init(); TK_OpenSource(acs_SourceFileName); PC_OpenObject(ObjectFileName, DEFAULT_OBJECT_SIZE, 0); PA_Parse(); PC_CloseObject(); TK_CloseSource(); MS_Message(MSG_NORMAL, "\n\"%s\":\n %d line%s (%d included)\n", acs_SourceFileName, tk_Line, tk_Line == 1 ? "" : "s", tk_IncludedLines); MS_Message(MSG_NORMAL, " %d function%s\n %d script%s\n", pc_FunctionCount, pc_FunctionCount == 1 ? "" : "s", pa_ScriptCount, pa_ScriptCount == 1 ? "" : "s"); for (i = 0; pa_TypedScriptCounts[i].TypeName; i++) { if (pa_TypedScriptCounts[i].TypeCount > 0) { MS_Message(MSG_NORMAL, "%5d %s\n", pa_TypedScriptCounts[i].TypeCount, pa_TypedScriptCounts[i].TypeName); } } MS_Message(MSG_NORMAL, " %d global variable%s\n" " %d world variable%s\n" " %d map variable%s\n" " %d global array%s\n" " %d world array%s\n", pa_GlobalVarCount, pa_GlobalVarCount == 1 ? "" : "s", pa_WorldVarCount, pa_WorldVarCount == 1 ? "" : "s", pa_MapVarCount, pa_MapVarCount == 1 ? "" : "s", pa_GlobalArrayCount, pa_GlobalArrayCount == 1 ? "" : "s", pa_WorldArrayCount, pa_WorldArrayCount == 1 ? "" : "s" ); MS_Message(MSG_NORMAL, " object \"%s\": %d bytes\n", ObjectFileName, pc_Address); ERR_RemoveErrorFile(); return 0; }