Added support for #include in IDL files (based on a patch by Robert

Shearman).
This commit is contained in:
Alexandre Julliard 2003-06-20 21:31:13 +00:00
parent 499cfcaf86
commit 0bcf775555
1 changed files with 23 additions and 8 deletions

View File

@ -292,24 +292,39 @@ static void parse_idl_file( INCL_FILE *pFile, FILE *file )
while (fgets( buffer, sizeof(buffer)-1, file )) while (fgets( buffer, sizeof(buffer)-1, file ))
{ {
char quote;
char *p = buffer; char *p = buffer;
line++; line++;
while (*p && isspace(*p)) p++; while (*p && isspace(*p)) p++;
if (strncmp( p, "import", 6 )) continue;
p += 6; if (!strncmp( p, "import", 6 ))
while (*p && isspace(*p)) p++; {
if (*p != '\"') continue; p += 6;
p++; while (*p && isspace(*p)) p++;
if (*p != '\"') continue;
}
else
{
if (*p++ != '#') continue;
while (*p && isspace(*p)) p++;
if (strncmp( p, "include", 7 )) continue;
p += 7;
while (*p && isspace(*p)) p++;
if (*p != '\"' && *p != '<' ) continue;
}
quote = *p++;
if (quote == '<') quote = '>';
include = p; include = p;
while (*p && (*p != '\"')) p++; while (*p && (*p != quote)) p++;
if (!*p) if (!*p)
{ {
fprintf( stderr, "%s:%d: Malformed import directive\n", fprintf( stderr, "%s:%d: Malformed #include or import directive\n",
pFile->filename, line ); pFile->filename, line );
exit(1); exit(1);
} }
*p = 0; *p = 0;
add_include( pFile, include, line, 0 ); add_include( pFile, include, line, (quote == '>') );
} }
} }