Moved data_convert_cell() out of data.c to the parser.

It constructs a cell_t, not data objects.
Renamed it to cell_from_string() as well.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
This commit is contained in:
Jon Loeliger 2007-02-16 09:33:54 -06:00
parent fd84d97dee
commit 3948849fd0
3 changed files with 27 additions and 24 deletions

20
data.c
View file

@ -225,26 +225,6 @@ struct data data_merge(struct data d1, struct data d2)
return d;
}
/*
* Convert a string representation of a numberic cell
* in the given base into a cell.
*/
cell_t data_convert_cell(char *s, unsigned int base)
{
cell_t c;
extern YYLTYPE yylloc;
c = strtoul(s, NULL, base);
if (errno == EINVAL || errno == ERANGE) {
fprintf(stderr,
"Line %d: Invalid cell value '%s'; %d assumed\n",
yylloc.first_line, s, c);
}
return c;
}
struct data data_append_cell(struct data d, cell_t word)
{
cell_t beword = cpu_to_be32(word);