static void CmFlushSourceCode ( void) { char Buffer; while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) { InsertLineBuffer ((int) Buffer); } ResetCurrentLineBuffer (); }
void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op) { FILE *IncFile; /* Op must be valid */ 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; } /* * Flush out the "include ()" statement on this line, start * the actual include file on the next line */ ResetCurrentLineBuffer (); FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); Gbl_CurrentLineOffset++; /* Prepend the directory pathname and open the include file */ DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", Op->Asl.Value.String); IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r"); if (!IncFile) { sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno)); AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); return; } /* Push the include file on the open input file stack */ AslPushInputFileStack (IncFile, Op->Asl.Value.String); }
void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op) { FILE *IncludeFile; ASL_INCLUDE_DIR *NextDir; /* Op must be valid */ 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; } /* * Flush out the "include ()" statement on this line, start * the actual include file on the next line */ ResetCurrentLineBuffer (); FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); Gbl_CurrentLineOffset++; /* Attempt to open the include file */ /* If the file specifies an absolute path, just open it */ if ((Op->Asl.Value.String[0] == '/') || (Op->Asl.Value.String[0] == '\\') || (Op->Asl.Value.String[1] == ':')) { IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); if (!IncludeFile) { goto ErrorExit; } return; } /* * 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. */ IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); if (IncludeFile) { return; } /* * Second, search for the file within the (possibly multiple) directories * specified by the -I option on the command line. */ NextDir = Gbl_IncludeDirList; while (NextDir) { IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); if (IncludeFile) { return; } NextDir = NextDir->Next; } /* We could not open the include file after trying very hard */ ErrorExit: sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); }