From c1f21665c7010c70b87f79e1b81dc7f2564f26c9 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 13 Feb 2024 05:22:07 +0000 Subject: utility: newly added --config, now producing compatible --config output. --- src/driver/slbt_amain.c | 3 +++ src/driver/slbt_driver_ctx.c | 8 ++++++++ src/driver/slbt_split_argv.c | 13 ++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src/driver') diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c index 0136625..9ac5669 100644 --- a/src/driver/slbt_amain.c +++ b/src/driver/slbt_amain.c @@ -65,6 +65,9 @@ static void slbt_perform_driver_actions(struct slbt_driver_ctx * dctx) if (dctx->cctx->drvflags & SLBT_DRIVER_FEATURES) slbt_output_features(dctx); + if (dctx->cctx->mode == SLBT_MODE_CONFIG) + slbt_output_config(dctx); + if (dctx->cctx->mode == SLBT_MODE_COMPILE) slbt_exec_compile(dctx,0); diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index bfb2206..a6e93d0 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -493,6 +493,10 @@ int slbt_get_driver_ctx( cctx.drvflags |= SLBT_DRIVER_INFO; break; + case TAG_CONFIG: + cctx.drvflags |= SLBT_DRIVER_OUTPUT_CONFIG; + break; + case TAG_DUMPMACHINE: cctx.drvflags |= SLBT_DRIVER_OUTPUT_MACHINE; break; @@ -773,6 +777,10 @@ int slbt_get_driver_ctx( cctx.output = 0; } + /* config mode */ + if (cctx.drvflags & SLBT_DRIVER_OUTPUT_CONFIG) + cctx.mode = SLBT_MODE_CONFIG; + /* info mode */ if (cctx.drvflags & (SLBT_DRIVER_INFO | SLBT_DRIVER_FEATURES)) cctx.mode = SLBT_MODE_INFO; diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c index 04800d8..601c1ad 100644 --- a/src/driver/slbt_split_argv.c +++ b/src/driver/slbt_split_argv.c @@ -52,6 +52,7 @@ int slbt_split_argv( struct argv_entry * help; struct argv_entry * version; struct argv_entry * info; + struct argv_entry * config; struct argv_entry * finish; struct argv_entry * features; struct argv_entry * ccwrap; @@ -117,8 +118,8 @@ int slbt_split_argv( return -1; } - /* missing all of --mode, --help, --version, --info, --dumpmachine, --features, and --finish? */ - mode = help = version = info = finish = features = ccwrap = dumpmachine = aropt = 0; + /* missing all of --mode, --help, --version, --info, --config, --dumpmachine, --features, and --finish? */ + mode = help = version = info = config = finish = features = ccwrap = dumpmachine = aropt = 0; for (entry=meta->entries; entry->fopt; entry++) if (entry->tag == TAG_MODE) @@ -129,6 +130,8 @@ int slbt_split_argv( version = entry; else if (entry->tag == TAG_INFO) info = entry; + else if (entry->tag == TAG_CONFIG) + config = entry; else if (entry->tag == TAG_FINISH) finish = entry; else if (entry->tag == TAG_FEATURES) @@ -155,7 +158,7 @@ int slbt_split_argv( return -1; } - if (!mode && !help && !version && !info && !finish && !features && !dumpmachine && !altmode) { + if (!mode && !help && !version && !info && !config && !finish && !features && !dumpmachine && !altmode) { slbt_dprintf(fderr, "%s: error: --mode must be specified.\n", program); @@ -163,7 +166,7 @@ int slbt_split_argv( } /* missing compiler? */ - if (!ctx.unitidx && !help && !info && !version && !finish && !features && !dumpmachine && !altmode && !aropt) { + if (!ctx.unitidx && !help && !info && !config && !version && !finish && !features && !dumpmachine && !altmode && !aropt) { if (flags & SLBT_DRIVER_VERBOSITY_ERRORS) slbt_dprintf(fderr, "%s: error: is missing.\n", @@ -323,7 +326,7 @@ int slbt_split_argv( if (ctx.unitidx) { (void)0; - } else if (help || version || features || info || dumpmachine || altmode) { + } else if (help || version || features || info || config || dumpmachine || altmode) { for (i=0; itargv[i] = argv[i]; -- cgit v1.2.3