Exemplo n.º 1
0
/* parser_string */
int parser_string(AsmPrefs * ap, AsmCode * code, char const * string)
{
	CppPrefs prefs;
	State state;
	size_t i;

	memset(&prefs, 0, sizeof(prefs));
#if 0
	prefs.filename = infile;
#endif
	prefs.filters = CPP_FILTER_COMMENT;
	memset(&state, 0, sizeof(state));
	state.code = code;
	if((state.cpp = cpp_new(&prefs)) == NULL)
		return -1;
	if(ap != NULL)
		for(i = 0; i < ap->defines_cnt; i++)
			/* FIXME check errors */
			cpp_define_add(state.cpp, ap->defines[i], NULL);
	if(_parser_scan(&state) != 0)
		return _parser_error(&state, "%s", error_get());
	if(_program(&state) != 0)
		error_set_code(1, "%s%u%s%u%s", "Compilation failed with ",
				state.error_cnt, " error(s) and ",
				state.warning_cnt, " warning(s)");
	if(state.token != NULL)
		token_delete(state.token);
	return state.error_cnt;
}
Exemplo n.º 2
0
/* parser */
int parser(AsmPrefs * ap, AsmCode * code, char const * infile)
{
	CppPrefs prefs;
	State state;

	memset(&prefs, 0, sizeof(prefs));
	prefs.filename = infile;
	prefs.filters = CPP_FILTER_COMMENT;
	memset(&state, 0, sizeof(state));
	state.code = code;
	if((state.cpp = cpp_new(&prefs)) == NULL)
		return -1;
	if(_parser_defines(&state, ap) != 0)
	{
		cpp_delete(state.cpp);
		return -1;
	}
	if(_parser_scan(&state) != 0)
	{
		cpp_delete(state.cpp);
		return _parser_error(&state, "%s", error_get());
	}
	if(_program(&state) != 0)
		error_set_code(1, "%s%s%u%s%u%s", infile,
				": Compilation failed with ", state.error_cnt,
				" error(s) and ", state.warning_cnt,
				" warning(s)");
	if(state.token != NULL)
		token_delete(state.token);
	return state.error_cnt;
}
Exemplo n.º 3
0
	KernelEntry::KernelEntry( TraceGenerator::TraceFormat f, 
		const std::string& n, const std::string& m, const std::string& p, 
		const std::string& h ) :
		format( f ), name( n ), module( m ), path( p ), header( h ),
		program( _program() )
	{
	
	}
Exemplo n.º 4
0
	KernelEntry::KernelEntry() : format( TraceGenerator::InvalidTraceFormat ),
		program( _program() )
	{
	
	}