MCPcopy Create free account
hub / github.com/crownengine/crown / fpp_cppmain

Function fpp_cppmain

3rdparty/bgfx/3rdparty/fcpp/cpp1.c:163–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161
162INLINE FILE_LOCAL
163ReturnCode fpp_cppmain(struct Global *global)
164{
165 /*
166 * Main process for cpp -- copies tokens from the current input
167 * stream (main file, include file, or a macro) to the output
168 * file.
169 */
170
171 int c; /* Current character */
172 int counter; /* newlines and spaces */
173 ReturnCode ret; /* return code variable type */
174
175 long bracelevel = 0;
176 long parenlevel = 0;
177 long bracketlevel = 0;
178 int fake = 0;
179
180#define MAX_FUNC_LENGTH 50
181
182 char tempfunc[MAX_FUNC_LENGTH + 1];
183 char tempfunc2[MAX_FUNC_LENGTH + 1];
184 char define = 0; /* probability of a function define phase in the program */
185 char prev = 0; /* previous type */
186 char go = 0;
187 unsigned include = 0;
188 char initfunc = 0;
189
190 /* Initialize for reading tokens */
191 global->tokenbsize = 50;
192 global->tokenbuf = malloc(global->tokenbsize + 1);
193 if(!global->tokenbuf)
194 return(FPP_OUT_OF_MEMORY);
195
196 global->functionname = malloc(global->tokenbsize + 1);
197 if(!global->functionname)
198 return(FPP_OUT_OF_MEMORY);
199 global->functionname[0] = '\0';
200
201 if(global->showspace) {
202 global->spacebuf = (char *)malloc(MAX_SPACE_SIZE);
203 if(!global->spacebuf)
204 return(FPP_OUT_OF_MEMORY);
205 }
206
207 if(global->showversion)
208 fpp_Error(global, VERSION_TEXT);
209
210 /*
211 * Explicitly output a #line at the start of cpp output so
212 * that lint (etc.) knows the name of the original source
213 * file. If we don't do this explicitly, we may get
214 * the name of the first #include file instead.
215 */
216 if(global->linelines) /* if #line lines are wanted! */
217 fpp_sharp(global);
218 /*
219 * This loop is started "from the top" at the beginning of each line
220 * wrongline is set FPP_TRUE in many places if it is necessary to write

Callers 1

fppPreProcessFunction · 0.85

Calls 15

fpp_ErrorFunction · 0.85
fpp_sharpFunction · 0.85
fpp_openincludeFunction · 0.85
fpp_getFunction · 0.85
fpp_PutcharFunction · 0.85
fpp_controlFunction · 0.85
fpp_skipnlFunction · 0.85
fpp_PutstringFunction · 0.85
fpp_ungetFunction · 0.85
fpp_macroidFunction · 0.85
fpp_catenateFunction · 0.85
strncpyFunction · 0.85

Tested by

no test coverage detected