Blame src/driver/amgc_unit_action.c

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(
bbff09
	const struct amgc_unit_ctx *	uctx,
bbff09
	const struct amgc_action *	action,
bbff09
	const struct amgc_layout *	layout,
bbff09
	FILE *				fout)
bbff09
{
bbff09
	switch (action->action) {
bbff09
		case AMGC_OUTPUT_ENUM:
bbff09
			if (action->symbol)
bbff09
				return -1;
bbff09
			else
bbff09
				return amgc_output_unit_enums(uctx,0,stdout);
bbff09
bbff09
		case AMGC_LIST_ENUM:
bbff09
			if (action->symbol)
bbff09
				return -1;
bbff09
			else
bbff09
				return amgc_list_unit_enums(uctx,0,stdout);
f2e43d
f2e43d
		case AMGC_OUTPUT_TYPEDEF:
f2e43d
			return amgc_output_unit_entities(
f2e43d
				uctx,ENTITY_TYPEDEF,action->subset,
f2e43d
				layout,fout);
0c91ec
0c91ec
		case AMGC_OUTPUT_STRUCT:
0c91ec
			return amgc_output_unit_structs(uctx,layout,fout);
0c91ec
0c91ec
		case AMGC_OUTPUT_UNION:
0c91ec
			return amgc_output_unit_unions(uctx,layout,fout);
bbff09
	}
bbff09
bbff09
	return -1;
bbff09
}