diff options
Diffstat (limited to 'source/compiler/aslstartup.c')
-rw-r--r-- | source/compiler/aslstartup.c | 173 |
1 files changed, 16 insertions, 157 deletions
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 0168fd0..b57b3b0 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -51,18 +51,8 @@ ACPI_MODULE_NAME ("aslstartup") -#define ASL_MAX_FILES 256 -static char *FileList[ASL_MAX_FILES]; -static BOOLEAN AslToFile = TRUE; - - /* Local prototypes */ -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier); - static UINT8 AslDetectSourceFileType ( ASL_FILE_INFO *Info); @@ -72,6 +62,11 @@ AslDoDisassembly ( void); +/* Globals */ + +static BOOLEAN AslToFile = TRUE; + + /******************************************************************************* * * FUNCTION: AslInitializeGlobals @@ -131,82 +126,6 @@ AslInitializeGlobals ( } -/****************************************************************************** - * - * FUNCTION: AsDoWildcard - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Process files via wildcards. This function is for the Windows - * case only. - * - ******************************************************************************/ - -static char ** -AsDoWildcard ( - char *DirectoryPathname, - char *FileSpecifier) -{ -#ifdef WIN32 - void *DirInfo; - char *Filename; - int FileCount; - - - FileCount = 0; - - /* Open parent directory */ - - DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); - if (!DirInfo) - { - /* Either the directory of file does not exist */ - - Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier; - FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN); - AslAbort (); - } - - /* Process each file that matches the wildcard specification */ - - while ((Filename = AcpiOsGetNextFilename (DirInfo))) - { - /* Add the filename to the file list */ - - FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); - strcpy (FileList[FileCount], Filename); - FileCount++; - - if (FileCount >= ASL_MAX_FILES) - { - printf ("Max files reached\n"); - FileList[0] = NULL; - return (FileList); - } - } - - /* Cleanup */ - - AcpiOsCloseDirectory (DirInfo); - FileList[FileCount] = NULL; - return (FileList); - -#else - /* - * Linux/Unix cases - Wildcards are expanded by the shell automatically. - * Just return the filename in a null terminated list - */ - FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); - strcpy (FileList[0], FileSpecifier); - FileList[1] = NULL; - - return (FileList); -#endif -} - - /******************************************************************************* * * FUNCTION: AslDetectSourceFileType @@ -395,6 +314,17 @@ AslDoOneFile ( AslInitializeGlobals (); PrInitializeGlobals (); + /* + * Extract the directory path. This path is used for possible include + * files and the optional AML filename embedded in the input file + * DefinitionBlock declaration. + */ + Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Gbl_Files[ASL_FILE_INPUT].Filename = Filename; /* @@ -543,77 +473,6 @@ AslDoOneFile ( /******************************************************************************* * - * FUNCTION: AslDoOnePathname - * - * PARAMETERS: Pathname - Full pathname, possibly with wildcards - * - * RETURN: Status - * - * DESCRIPTION: Process one pathname, possible terminated with a wildcard - * specification. If a wildcard, it is expanded and the multiple - * files are processed. - * - ******************************************************************************/ - -ACPI_STATUS -AslDoOnePathname ( - char *Pathname, - ASL_PATHNAME_CALLBACK PathCallback) -{ - ACPI_STATUS Status = AE_OK; - char **WildcardList; - char *Filename; - char *FullPathname; - - - /* Split incoming path into a directory/filename combo */ - - Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Expand possible wildcard into a file list (Windows/DOS only) */ - - WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename); - while (*WildcardList) - { - FullPathname = ACPI_ALLOCATE ( - strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1); - - /* Construct a full path to the file */ - - strcpy (FullPathname, Gbl_DirectoryPath); - strcat (FullPathname, *WildcardList); - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = FullPathname; - } - - /* Save status from all compiles */ - - Status |= (*PathCallback) (FullPathname); - - ACPI_FREE (FullPathname); - ACPI_FREE (*WildcardList); - *WildcardList = NULL; - WildcardList++; - } - - ACPI_FREE (Gbl_DirectoryPath); - ACPI_FREE (Filename); - return (Status); -} - - -/******************************************************************************* - * * FUNCTION: AslCheckForErrorExit * * PARAMETERS: None. Examines global exception count array |