tools/makedep.c
/*******************************************************************
 *         parse_idl_file
 *
 * If for_h_file is non-zero, it means we are not interested in the idl file
 * itself, but only in the contents of the .h file that will be generated from it.
 */
parse_idl_file
If for_h_file is non-zero, it means we are not interested in the idl file
itself, but only in the contents of the .h file that will be generated from it.
parse_idl_file If for_h_file is non - zero it means we are not interested in the idl file itself but only in the contents of the . h file that will be generated from it .
static void parse_idl_file( INCL_FILE *pFile, FILE *file, int for_h_file )
{
    char *buffer, *include;
    if (for_h_file)
    {
        add_include( pFile, "rpc.h", 0, 1 );
        add_include( pFile, "rpcndr.h", 0, 1 );
    }
    input_line = 0;
    while ((buffer = get_line( file )))
    {
        char quote;
        char *p = buffer;
        while (*p && isspace(*p)) p++;
        if (!strncmp( p, "import", 6 ))
        {
            p += 6;
            while (*p && isspace(*p)) p++;
            if (*p != '"') continue;
            include = ++p;
            while (*p && (*p != '"')) p++;
            if (!*p) fatal_error( "%s:%d: error: Malformed import directive\n",
                                  pFile->filename, input_line );
            *p = 0;
            if (for_h_file && strendswith( include, ".idl" )) strcpy( p - 4, ".h" );
            add_include( pFile, include, input_line, 0 );
            continue;
        }
        if (for_h_file)  
        {
            if (strncmp( p, "cpp_quote", 9 )) continue;
            p += 9;
            while (*p && isspace(*p)) p++;
            if (*p++ != '(') continue;
            while (*p && isspace(*p)) p++;
            if (*p++ != '"') continue;
            if (*p++ != '#') continue;
            while (*p && isspace(*p)) p++;
            if (strncmp( p, "include", 7 )) continue;
            p += 7;
            while (*p && isspace(*p)) p++;
            if (*p == '\\' && p[1] == '"')
            {
                p += 2;
                quote = '"';
            }
            else
            {
                if (*p++ != '<' ) continue;
                quote = '>';
            }
            include = p;
            while (*p && (*p != quote)) p++;
            if (!*p || (quote == '"' && p[-1] != '\\'))
                fatal_error( "%s:%d: error: Malformed #include directive inside cpp_quote\n",
                             pFile->filename, input_line );
            if (quote == '"') p--;  
            *p = 0;
            add_include( pFile, include, input_line, (quote == '>') );
            continue;
        }
        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;
        while (*p && (*p != quote)) p++;
        if (!*p) fatal_error( "%s:%d: error: Malformed #include directive\n",
                              pFile->filename, input_line );
        *p = 0;
        add_include( pFile, include, input_line, (quote == '>') );
    }
}
static void parse_idl_file ( INCL_FILE * pFile , FILE * file , int for_h_file ) { char * buffer , * include ; if ( for_h_file ) { add_include ( pFile , " " , 0 , 1 ) ; add_include ( pFile , " " , 0 , 1 ) ; } input_line = 0 ; while ( ( buffer = get_line ( file ) ) ) { char quote ; char * p = buffer ; while ( * p && isspace ( * p ) ) p ++ ; if ( ! strncmp ( p , " " , 6 ) ) { p += 6 ; while ( * p && isspace ( * p ) ) p ++ ; if ( * p != ' ' ) continue ; include = ++ p ; while ( * p && ( * p != ' ' ) ) p ++ ; if ( ! * p ) fatal_error ( " \n " , pFile -> filename , input_line ) ; * p = 0 ; if ( for_h_file && strendswith ( include , " " ) ) strcpy ( p - 4 , " " ) ; add_include ( pFile , include , input_line , 0 ) ; continue ; } if ( for_h_file ) { if ( strncmp ( p , " " , 9 ) ) continue ; p += 9 ; while ( * p && isspace ( * p ) ) p ++ ; if ( * p ++ != ' ' ) continue ; while ( * p && isspace ( * p ) ) p ++ ; if ( * p ++ != ' ' ) continue ; if ( * p ++ != ' ' ) continue ; while ( * p && isspace ( * p ) ) p ++ ; if ( strncmp ( p , " " , 7 ) ) continue ; p += 7 ; while ( * p && isspace ( * p ) ) p ++ ; if ( * p == ' \\ ' && p [ 1 ] == ' ' ) { p += 2 ; quote = ' ' ; } else { if ( * p ++ != ' ' ) continue ; quote = ' ' ; } include = p ; while ( * p && ( * p != quote ) ) p ++ ; if ( ! * p || ( quote == ' ' && p [ -1 ] != ' \\ ' ) ) fatal_error ( " \n " , pFile -> filename , input_line ) ; if ( quote == ' ' ) p -- ; * p = 0 ; add_include ( pFile , include , input_line , ( quote == ' ' ) ) ; continue ; } if ( * p ++ != ' ' ) continue ; while ( * p && isspace ( * p ) ) p ++ ; if ( strncmp ( p , " " , 7 ) ) continue ; p += 7 ; while ( * p && isspace ( * p ) ) p ++ ; if ( * p != ' \" ' && * p != ' ' ) continue ; quote = * p ++ ; if ( quote == ' ' ) quote = ' ' ; include = p ; while ( * p && ( * p != quote ) ) p ++ ; if ( ! * p ) fatal_error ( " \n " , pFile -> filename , input_line ) ; * p = 0 ; add_include ( pFile , include , input_line , ( quote == ' ' ) ) ; } }
parse_idl_file
 If for_h_file is non-zero, it means we are not interested in the idl file
 itself, but only in the contents of the .h file that will be generated from it.
parse_idl_file If for_h_file is non - zero it means we are not interested in the idl file itself but only in the contents of the . h file that will be generated from it .
/* generated .h file always includes these */ /* only check for #include inside cpp_quote */ /* remove backslash */ /* check for normal #include */