1986-03-26 15:11:02 +00:00
|
|
|
/* M I S C E L L A N E O U S R O U T I N E S */
|
|
|
|
|
|
|
|
static char *RcsId = "$Header$";
|
|
|
|
|
|
|
|
#include <alloc.h>
|
|
|
|
#include <em_arith.h>
|
|
|
|
#include "f_info.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "LLlex.h"
|
|
|
|
#include "idf.h"
|
|
|
|
|
|
|
|
match_id(id1, id2)
|
|
|
|
struct idf *id1, *id2;
|
|
|
|
{
|
|
|
|
/* Check that identifiers id1 and id2 are equal. If they
|
|
|
|
are not, check that we did'nt generate them in the
|
|
|
|
first place, and if not, give an error message
|
|
|
|
*/
|
|
|
|
if (id1 != id2 && !is_anon_idf(id1) && !is_anon_idf(id2)) {
|
1986-03-26 22:46:48 +00:00
|
|
|
error("Name \"%s\" does not match block name \"%s\"",
|
1986-03-26 15:11:02 +00:00
|
|
|
id1->id_text,
|
|
|
|
id2->id_text
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct idf *
|
|
|
|
gen_anon_idf()
|
|
|
|
{
|
|
|
|
/* A new idf is created out of nowhere, to serve as an
|
|
|
|
anonymous name.
|
|
|
|
*/
|
|
|
|
static int name_cnt;
|
|
|
|
char buff[100];
|
1986-04-03 17:41:26 +00:00
|
|
|
char *sprint();
|
1986-03-26 15:11:02 +00:00
|
|
|
|
1986-04-03 17:41:26 +00:00
|
|
|
sprint(buff, "#%d in %s, line %u",
|
1986-03-26 15:11:02 +00:00
|
|
|
++name_cnt, FileName, LineNumber);
|
|
|
|
return str2idf(buff, 1);
|
|
|
|
}
|
1986-04-03 17:41:26 +00:00
|
|
|
|
|
|
|
id_not_declared(id)
|
|
|
|
struct idf *id;
|
|
|
|
{
|
|
|
|
/* The identifier "id" is not declared. If it is not generated,
|
|
|
|
give an error message
|
|
|
|
*/
|
|
|
|
if (!is_anon_idf(id)) {
|
|
|
|
error("identifier \"%s\" not declared", id->id_text);
|
|
|
|
}
|
|
|
|
}
|