MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cmd_pipeline_codegen

Function cmd_pipeline_codegen

dpdk/examples/pipeline/cli.c:583–627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581"pipeline codegen <spec_file> <code_file>\n";
582
583static void
584cmd_pipeline_codegen(char **tokens,
585 uint32_t n_tokens,
586 char *out,
587 size_t out_size,
588 void *obj __rte_unused)
589{
590 FILE *spec_file = NULL;
591 FILE *code_file = NULL;
592 uint32_t err_line;
593 const char *err_msg;
594 int status;
595
596 if (n_tokens != 4) {
597 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
598 return;
599 }
600
601 spec_file = fopen(tokens[2], "r");
602 if (!spec_file) {
603 snprintf(out, out_size, "Cannot open file %s.\n", tokens[2]);
604 return;
605 }
606
607 code_file = fopen(tokens[3], "w");
608 if (!code_file) {
609 snprintf(out, out_size, "Cannot open file %s.\n", tokens[3]);
610 fclose(spec_file);
611 return;
612 }
613
614 status = rte_swx_pipeline_codegen(spec_file,
615 code_file,
616 &err_line,
617 &err_msg);
618
619 fclose(spec_file);
620 fclose(code_file);
621
622 if (status) {
623 snprintf(out, out_size, "Error %d at line %u: %s\n.",
624 status, err_line, err_msg);
625 return;
626 }
627}
628
629static const char cmd_pipeline_libbuild_help[] =
630"pipeline libbuild <code_file> <lib_file>\n";

Callers 1

cli_processFunction · 0.85

Calls 2

snprintfFunction · 0.85
rte_swx_pipeline_codegenFunction · 0.85

Tested by

no test coverage detected