From 0c91ec9d3ffdcc3a978eaa3bc02470462d34df7a Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 30 Jan 2016 20:15:20 -0500 Subject: driver: --print-structs and --print-unions: initial integration. --- src/output/amgc_output_compound.c | 28 ++++++++++++++++++++++++++++ src/output/amgc_output_entities.c | 6 ++++++ 2 files changed, 34 insertions(+) (limited to 'src/output') diff --git a/src/output/amgc_output_compound.c b/src/output/amgc_output_compound.c index 07bd730..fc95af7 100644 --- a/src/output/amgc_output_compound.c +++ b/src/output/amgc_output_compound.c @@ -346,3 +346,31 @@ int amgc_output_union( else return -1; } + +int amgc_output_unit_structs( + const struct amgc_unit_ctx * uctx, + const struct amgc_layout * layout, + FILE * fout) +{ + const struct amgc_entity * aentity; + + for (aentity=uctx->entities->structs; aentity->entity; aentity++) + if (output_compound_entity(uctx,aentity,layout,fout)) + return -1; + + return 0; +} + +int amgc_output_unit_unions( + const struct amgc_unit_ctx * uctx, + const struct amgc_layout * layout, + FILE * fout) +{ + const struct amgc_entity * aentity; + + for (aentity=uctx->entities->unions; aentity->entity; aentity++) + if (output_compound_entity(uctx,aentity,layout,fout)) + return -1; + + return 0; +} diff --git a/src/output/amgc_output_entities.c b/src/output/amgc_output_entities.c index 9d8d017..c1618c2 100644 --- a/src/output/amgc_output_entities.c +++ b/src/output/amgc_output_entities.c @@ -40,6 +40,12 @@ int amgc_output_unit_entities( case ENTITY_TYPEDEF: return output_typedefs(uctx,subset,layout,fout); + + case ENTITY_STRUCT: + return amgc_output_unit_structs(uctx,layout,fout); + + case ENTITY_UNION: + return amgc_output_unit_unions(uctx,layout,fout); } return -1; -- cgit v1.2.3