MCPcopy Create free account
hub / github.com/Singular/Singular / ExecCompiler

Function ExecCompiler

ppcc/src/ppcc.cc:244–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void ExecCompiler() {
245 int exitcode;
246 Int inputs;
247 StrArr *args = new StrArr(1);
248 switch (inputs = CInput->len() + CCInput->len()) {
249 case 0:
250 if (mode == COMP)
251 Error("no input files");;
252 break;
253 case 1:
254 break;
255 default:
256 Error("too many C/C++ input files");
257 break;
258 }
259 switch (mode) {
260 case CPP:
261 PassThroughCompiler();
262 break;
263 case COMP:
264 args->add(S("-c"))->add(CompArgs);
265 break;
266 case LINK:
267 args->add(LinkArgs);
268 break;
269 }
270 if (inputs) {
271 Str *cppOutput = RunCPP();
272 const char *lang = CInput->len() == 1 ? "c" : "c++";
273 args->add(S("-x"))->add(S(lang))->add(S("-"));
274 if (debug) {
275 printf("%s: %s %s\n",
276 mode == COMP ? "Compiler" : "Linker",
277 Compiler->c_str(),
278 StrJoin(args, " ")->c_str());
279 if (debug >= 2)
280 Print(cppOutput);
281 fflush(stdout);
282 }
283 int success = WriteProcess(Compiler, args, cppOutput);
284 if (!success)
285 exit(1);
286 } else {
287 TestOutputExecutable();
288 PassThroughCompiler();
289 }
290}
291
292INIT(Args, {
293 GCVar(Language);

Callers 1

MainFunction · 0.85

Calls 11

ErrorFunction · 0.85
PassThroughCompilerFunction · 0.85
RunCPPFunction · 0.85
StrJoinFunction · 0.85
WriteProcessFunction · 0.85
TestOutputExecutableFunction · 0.85
c_strMethod · 0.80
SFunction · 0.50
PrintFunction · 0.50
lenMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected