FreeBSD/sys/contrib/dev/acpica/compiler/aslfiles.c
/*******************************************************************************
 *
 * FUNCTION:    FlOpenIncludeFile
 *
 * PARAMETERS:  Op        - Parse node for the INCLUDE ASL statement
 *
 * RETURN:      None.
 *
 * DESCRIPTION: Open an include file and push it on the input file stack.
 *
 ******************************************************************************/
FlOpenIncludeFile
PARAMETERS:  Op        - Parse node for the INCLUDE ASL statement

None.

Open an include file and push it on the input file stack.
FlOpenIncludeFile PARAMETERS : Op - Parse node for the INCLUDE ASL statement None . Open an include file and push it on the input file stack .
void
FlOpenIncludeFile (
    ACPI_PARSE_OBJECT       *Op)
{
    FILE                    *IncludeFile;
    ASL_INCLUDE_DIR         *NextDir;
    if (!Op)
    {
        AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN,
            Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
            Gbl_InputByteCount, Gbl_CurrentColumn,
            Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node");
        return;
    }
    AslResetCurrentLineBuffer ();
    FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
    Gbl_CurrentLineOffset++;
    if ((Op->Asl.Value.String[0] == '/')  ||
        (Op->Asl.Value.String[0] == '\\') ||
        (Op->Asl.Value.String[1] == ':'))
    {
        IncludeFile = FlOpenIncludeWithPrefix ("", Op, Op->Asl.Value.String);
        if (!IncludeFile)
        {
            goto ErrorExit;
        }
        return;
    }
    IncludeFile = FlOpenIncludeWithPrefix (
        Gbl_DirectoryPath, Op, Op->Asl.Value.String);
    if (IncludeFile)
    {
        return;
    }
    NextDir = Gbl_IncludeDirList;
    while (NextDir)
    {
        IncludeFile = FlOpenIncludeWithPrefix (
            NextDir->Dir, Op, Op->Asl.Value.String);
        if (IncludeFile)
        {
            return;
        }
        NextDir = NextDir->Next;
    }
ErrorExit:
    sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno));
    AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
}
void FlOpenIncludeFile ( ACPI_PARSE_OBJECT * Op ) { FILE * IncludeFile ; ASL_INCLUDE_DIR * NextDir ; if ( ! Op ) { AslCommonError ( ASL_ERROR , ASL_MSG_INCLUDE_FILE_OPEN , Gbl_CurrentLineNumber , Gbl_LogicalLineNumber , Gbl_InputByteCount , Gbl_CurrentColumn , Gbl_Files [ ASL_FILE_INPUT ] . Filename , " " ) ; return ; } AslResetCurrentLineBuffer ( ) ; FlPrintFile ( ASL_FILE_SOURCE_OUTPUT , " \n " ) ; Gbl_CurrentLineOffset ++ ; if ( ( Op -> Asl . Value . String [ 0 ] == ' ' ) || ( Op -> Asl . Value . String [ 0 ] == ' \\ ' ) || ( Op -> Asl . Value . String [ 1 ] == ' ' ) ) { IncludeFile = FlOpenIncludeWithPrefix ( " " , Op , Op -> Asl . Value . String ) ; if ( ! IncludeFile ) { goto ErrorExit ; } return ; } IncludeFile = FlOpenIncludeWithPrefix ( Gbl_DirectoryPath , Op , Op -> Asl . Value . String ) ; if ( IncludeFile ) { return ; } NextDir = Gbl_IncludeDirList ; while ( NextDir ) { IncludeFile = FlOpenIncludeWithPrefix ( NextDir -> Dir , Op , Op -> Asl . Value . String ) ; if ( IncludeFile ) { return ; } NextDir = NextDir -> Next ; } ErrorExit : sprintf ( MsgBuffer , " " , Op -> Asl . Value . String , strerror ( errno ) ) ; AslError ( ASL_ERROR , ASL_MSG_INCLUDE_FILE_OPEN , Op , MsgBuffer ) ; }
FUNCTION:    FlOpenIncludeFile
 PARAMETERS:  Op        - Parse node for the INCLUDE ASL statement
FUNCTION : FlOpenIncludeFile PARAMETERS : Op - Parse node for the INCLUDE ASL statement
/* Op must be valid */ /*
     * Flush out the "include ()" statement on this line, start
     * the actual include file on the next line
     */ /* Attempt to open the include file */ /* If the file specifies an absolute path, just open it */ /*
     * The include filename is not an absolute path.
     *
     * First, search for the file within the "local" directory -- meaning
     * the same directory that contains the source file.
     *
     * Construct the file pathname from the global directory name.
     */ /*
     * Second, search for the file within the (possibly multiple) directories
     * specified by the -I option on the command line.
     */ /* We could not open the include file after trying very hard */