/*
 * semantic checks: specifically, check all functions called are defined
 *		    (using callhash and funchash)
 */

#include <stdio.h>

#include "types.h"
#include "funchash.h"
#include "callhash.h"
#include "semchecks.h"


extern int yyerrors;
extern void yyerror(const char *str);


static void check_one_call( char *name )
{
	if( ! lookup_function(name) )
	{
		char mesg[1024];
		sprintf( mesg, "call to undefined function '%s'", name );
		yyerror( mesg );
	}
}


void check_calls()
{
	foreach_call( &check_one_call );
}
