MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / ParseSMCFile

Method ParseSMCFile

tools/gdc/TextParsers.cpp:116–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116SMCError TextParsers::ParseSMCFile(const char *file,
117 ITextListener_SMC *smc_listener,
118 SMCStates *states,
119 char *buffer,
120 size_t maxsize)
121{
122 const char *errstr;
123 FILE *fp = fopen(file, "rt");
124
125 if (fp == NULL)
126 {
127 char error[256] = "unknown";
128 if (states != NULL)
129 {
130 states->line = 0;
131 states->col = 0;
132 }
133 //g_LibSys.GetPlatformError(error, sizeof(error));
134 UTIL_Format(buffer, maxsize, "File could not be opened: %s", error);
135 return SMCError_StreamOpen;
136 }
137
138 SMCError result = ParseStream_SMC(fp, FileStreamReader, smc_listener, states);
139
140 fclose(fp);
141
142 errstr = GetSMCErrorString(result);
143 UTIL_Format(buffer, maxsize, "%s", errstr != NULL ? errstr : "Unknown error");
144
145 return result;
146}
147
148struct RawStream
149{

Callers 2

ReparseMethod · 0.45
EnterFileMethod · 0.45

Calls 1

UTIL_FormatFunction · 0.70

Tested by

no test coverage detected