diff options
author | midipix <writeonce@midipix.org> | 2016-01-08 16:41:14 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-01-09 05:32:50 -0500 |
commit | 43b7a222c0944f84a077f0a58d9566530630def2 (patch) | |
tree | 0c01a3aec0496e1e6773f879d5e048cab3aac49b /src | |
parent | bbff09033370ecee3ed999fe094494463c338add (diff) | |
download | apimagic-43b7a222c0944f84a077f0a58d9566530630def2.tar.bz2 apimagic-43b7a222c0944f84a077f0a58d9566530630def2.tar.xz |
amgc_output_unit_entities(): initial implementation.
Diffstat (limited to 'src')
-rw-r--r-- | src/output/amgc_output_entities.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/output/amgc_output_entities.c b/src/output/amgc_output_entities.c new file mode 100644 index 0000000..9d8d017 --- /dev/null +++ b/src/output/amgc_output_entities.c @@ -0,0 +1,46 @@ +/**********************************************************/ +/* apimagic: cparser-based API normalization utility */ +/* Copyright (C) 2015--2016 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */ +/**********************************************************/ + +#include <stdio.h> + +#include <cparser/ast/entity_t.h> +#include <cparser/ast/type_t.h> + +#include <apimagic/apimagic.h> +#include "apimagic_driver_impl.h" + +static int output_typedefs( + const struct amgc_unit_ctx * uctx, + int subset, + const struct amgc_layout * layout, + FILE * fout) +{ + struct amgc_entity * aentity; + + for (aentity=uctx->entities->typedefs; aentity->entity; aentity++) + if (aentity->reftype->kind == subset) + if (amgc_output_typedef(uctx,aentity,layout,fout) < 0) + return -1; + return 0; +} + +int amgc_output_unit_entities( + const struct amgc_unit_ctx * uctx, + int kind, + int subset, + const struct amgc_layout * layout, + FILE * fout) +{ + switch (kind) { + case ENTITY_ENUM: + return amgc_output_unit_enums(uctx,layout,fout); + + case ENTITY_TYPEDEF: + return output_typedefs(uctx,subset,layout,fout); + } + + return -1; +} |