feat(specs-gen): improve flexibility by add -i opt for including N amount of dependency headers
static void print_usage(char *prog)
{
fprintf(stderr,
- "Usage: %s [-h|-c|-d|-f] -o output-file input-file\n"
+ "Usage: %s [-h|-c|-d|-f] -o output-file -i include-headers input-file \n"
" -h generate header\n"
" -c generate data and function definitions\n"
" -d generate data and function declarations\n"
@@ -35,9 +35,10 @@ int main(int argc, char **argv)
};
char *open_mode = "w";
+ NTL_T(name_t) incl_headers = NULL;
int opt;
- while (-1 != (opt = getopt(argc, argv, "ahcdfSEFOo:"))) {
+ while (-1 != (opt = getopt(argc, argv, "ahcdfSEFOo:i:"))) {
switch (opt) {
case 'a':
open_mode = "a";
@@ -45,6 +46,9 @@ int main(int argc, char **argv)
case 'o':
config_file = strdup(optarg);
break;
+ case 'i':
+ ntl_append2((ntl_t*)&incl_headers, sizeof(name_t), optarg);
+ break;
case 'h':
eo.type = FILE_HEADER;
break;
@@ -87,6 +91,7 @@ int main(int argc, char **argv)
memset(&d, 0, sizeof(d));
definition_from_json(s, len, &d);
d.spec_name = file;
+ d.incl_headers = incl_headers;
gen_definition(config_file, open_mode, &eo, &d);
return EXIT_SUCCESS;
