|
|
bbff09 |
/**********************************************************/
|
|
|
bbff09 |
/* apimagic: cparser-based API normalization utility */
|
|
|
bbff09 |
/* Copyright (C) 2015--2016 Z. Gilboa */
|
|
|
bbff09 |
/* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */
|
|
|
bbff09 |
/**********************************************************/
|
|
|
bbff09 |
|
|
|
daa2a2 |
#include <stdio.h>
|
|
|
f2e43d |
#include <cparser/ast/entity_t.h>
|
|
|
f2e43d |
|
|
|
bbff09 |
#include <apimagic/apimagic.h>
|
|
|
bbff09 |
#include "apimagic_driver_impl.h"
|
|
|
bbff09 |
|
|
|
bbff09 |
int amgc_perform_unit_action(
|
|
|
b8225b |
const struct amgc_driver_ctx * dctx,
|
|
|
bbff09 |
const struct amgc_unit_ctx * uctx,
|
|
|
bbff09 |
const struct amgc_action * action,
|
|
|
b8225b |
const struct amgc_layout * layout)
|
|
|
bbff09 |
{
|
|
|
bbff09 |
switch (action->action) {
|
|
|
bbff09 |
case AMGC_OUTPUT_ENUM:
|
|
|
bbff09 |
if (action->symbol)
|
|
|
bbff09 |
return -1;
|
|
|
bbff09 |
else
|
|
|
b8225b |
return amgc_output_unit_enums(dctx,uctx,0);
|
|
|
bbff09 |
|
|
|
bbff09 |
case AMGC_LIST_ENUM:
|
|
|
bbff09 |
if (action->symbol)
|
|
|
bbff09 |
return -1;
|
|
|
bbff09 |
else
|
|
|
b8225b |
return amgc_list_unit_enums(dctx,uctx,0);
|
|
|
f2e43d |
|
|
|
f2e43d |
case AMGC_OUTPUT_TYPEDEF:
|
|
|
f2e43d |
return amgc_output_unit_entities(
|
|
|
b8225b |
dctx,uctx,ENTITY_TYPEDEF,
|
|
|
b8225b |
action->subset,layout);
|
|
|
0c91ec |
|
|
|
0c91ec |
case AMGC_OUTPUT_STRUCT:
|
|
|
b8225b |
return amgc_output_unit_structs(dctx,uctx,layout);
|
|
|
0c91ec |
|
|
|
0c91ec |
case AMGC_OUTPUT_UNION:
|
|
|
b8225b |
return amgc_output_unit_unions(dctx,uctx,layout);
|
|
|
bbff09 |
}
|
|
|
bbff09 |
|
|
|
bbff09 |
return -1;
|
|
|
bbff09 |
}
|