* src/reader.c (parse_dquoted_param): New.

(parse_header_extension_decl): Use it.
(parse_source_extension_decl): Likewise.
This commit is contained in:
Marc Autret
2001-08-16 20:48:02 +00:00
parent af550e2927
commit 7a360eeaed
2 changed files with 59 additions and 15 deletions

View File

@@ -1,3 +1,9 @@
2001-08-16 Marc Autret <autret_m@epita.fr>
* src/reader.c (parse_dquoted_param): New.
(parse_header_extension_decl): Use it.
(parse_source_extension_decl): Likewise.
2001-08-16 Marc Autret <autret_m@epita.fr>
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.

View File

@@ -874,34 +874,72 @@ parse_thong_decl (void)
nsyms--;
}
/*------------------------------------------.
| Parse what comes after %header_extension. |
`------------------------------------------*/
/*--------------------------------------------------------------.
| Parse what comes after %header_extension and %source_etension |
`--------------------------------------------------------------*/
static const char *
parse_dquoted_param (const char *from)
{
char buff[32];
int c;
int index;
c = skip_white_space ();
if (c != '"')
{
ungetc (c, finput);
complain (_("invalid %s declaration"), from);
return NULL;
}
c = getc (finput);
for (index = 0; (c >= '!') && (c <= '~'); index++)
{
if (c == '"')
break;
if (c == '\\')
{
c = getc (finput);
if ((c < '!') && (c > '~'))
break;
}
buff[index] = c;
c = getc (finput);
}
buff[index] = '\0';
if (c != '"')
{
ungetc (c, finput);
complain (_("invalid %s declaration"), from);
return NULL;
}
return xstrdup (buff);
}
/* %header_extension case. */
static void
parse_header_extension_decl (void)
{
char buff[32];
if (header_extension)
complain (_("multiple %%header_extension declarations"));
fscanf (finput, "%s", buff);
header_extension = xstrdup (buff);
header_extension = parse_dquoted_param ("%header_extension");
}
/*------------------------------------------.
| Parse what comes after %source_extension. |
`------------------------------------------*/
/* %source_extension case. */
static void
parse_source_extension_decl (void)
{
char buff[32];
if (src_extension)
complain (_("multiple %%source_extension declarations"));
fscanf (finput, "%s", buff);
src_extension = xstrdup (buff);
src_extension = parse_dquoted_param ("%source_extension");
}
/*----------------------------------------------------------------.