Blob Blame History Raw
/**********************************************************/
/*  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 <apimagic/apimagic.h>
#include "apimagic_driver_impl.h"

int amgc_perform_unit_action(
	const struct amgc_unit_ctx *	uctx,
	const struct amgc_action *	action,
	const struct amgc_layout *	layout,
	FILE *				fout)
{
	switch (action->action) {
		case AMGC_OUTPUT_ENUM:
			if (action->symbol)
				return -1;
			else
				return amgc_output_unit_enums(uctx,0,stdout);

		case AMGC_LIST_ENUM:
			if (action->symbol)
				return -1;
			else
				return amgc_list_unit_enums(uctx,0,stdout);

		case AMGC_OUTPUT_TYPEDEF:
			return amgc_output_unit_entities(
				uctx,ENTITY_TYPEDEF,action->subset,
				layout,fout);
	}

	return -1;
}