summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-05 00:48:15 -0400
committermidipix <writeonce@midipix.org>2018-08-05 03:22:21 -0400
commitb8225b67f6e452b4751150e52b3dfee54744f4bf (patch)
tree748f2bac1ad7fb7041507ff7251ac0b9b4bac754 /src/driver
parentabf92311681c10ed589ac05f0f2b451e01fbc63e (diff)
downloadapimagic-b8225b67f6e452b4751150e52b3dfee54744f4bf.tar.bz2
apimagic-b8225b67f6e452b4751150e52b3dfee54744f4bf.tar.xz
output interfaces: revised API and implementation to use fdctx and pure fdio.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/amgc_amain.c8
-rw-r--r--src/driver/amgc_unit_action.c16
2 files changed, 13 insertions, 11 deletions
diff --git a/src/driver/amgc_amain.c b/src/driver/amgc_amain.c
index 096b960..9325a4f 100644
--- a/src/driver/amgc_amain.c
+++ b/src/driver/amgc_amain.c
@@ -47,12 +47,14 @@ static ssize_t amgc_version(struct amgc_driver_ctx * dctx, int fdout)
verclr[4],verinfo->commit,verclr[5]);
}
-static void amgc_perform_unit_actions(struct amgc_unit_ctx * uctx)
+static void amgc_perform_unit_actions(
+ const struct amgc_driver_ctx * dctx,
+ struct amgc_unit_ctx * uctx)
{
const struct amgc_action * action;
for (action=uctx->cctx->actions; action->type; action++)
- amgc_perform_unit_action(uctx,action,0,stdout);
+ amgc_perform_unit_action(dctx,uctx,action,0);
}
static int amgc_exit(struct amgc_driver_ctx * dctx, int ret)
@@ -85,7 +87,7 @@ int amgc_main(int argc, char ** argv, char ** envp, const struct amgc_fd_ctx * f
for (unit=dctx->units; *unit && !dctx->errv[0]; unit++) {
if (!(amgc_get_unit_ctx(dctx,*unit,&uctx))) {
- amgc_perform_unit_actions(uctx);
+ amgc_perform_unit_actions(dctx,uctx);
amgc_free_unit_ctx(uctx);
}
}
diff --git a/src/driver/amgc_unit_action.c b/src/driver/amgc_unit_action.c
index 29bc446..6189481 100644
--- a/src/driver/amgc_unit_action.c
+++ b/src/driver/amgc_unit_action.c
@@ -11,34 +11,34 @@
#include "apimagic_driver_impl.h"
int amgc_perform_unit_action(
+ const struct amgc_driver_ctx * dctx,
const struct amgc_unit_ctx * uctx,
const struct amgc_action * action,
- const struct amgc_layout * layout,
- FILE * fout)
+ const struct amgc_layout * layout)
{
switch (action->action) {
case AMGC_OUTPUT_ENUM:
if (action->symbol)
return -1;
else
- return amgc_output_unit_enums(uctx,0,stdout);
+ return amgc_output_unit_enums(dctx,uctx,0);
case AMGC_LIST_ENUM:
if (action->symbol)
return -1;
else
- return amgc_list_unit_enums(uctx,0,stdout);
+ return amgc_list_unit_enums(dctx,uctx,0);
case AMGC_OUTPUT_TYPEDEF:
return amgc_output_unit_entities(
- uctx,ENTITY_TYPEDEF,action->subset,
- layout,fout);
+ dctx,uctx,ENTITY_TYPEDEF,
+ action->subset,layout);
case AMGC_OUTPUT_STRUCT:
- return amgc_output_unit_structs(uctx,layout,fout);
+ return amgc_output_unit_structs(dctx,uctx,layout);
case AMGC_OUTPUT_UNION:
- return amgc_output_unit_unions(uctx,layout,fout);
+ return amgc_output_unit_unions(dctx,uctx,layout);
}
return -1;