2 /******************************************************************************
4 * Module Name: aslfiles - file I/O suppoert
6 *****************************************************************************/
9 * Copyright (C) 2000 - 2012, Intel Corp.
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
45 #include <contrib/dev/acpica/compiler/aslcompiler.h>
46 #include <contrib/dev/acpica/include/acapps.h>
48 #define _COMPONENT ACPI_COMPILER
49 ACPI_MODULE_NAME ("aslfiles")
51 /* Local prototypes */
54 FlOpenIncludeWithPrefix (
59 #ifdef ACPI_OBSOLETE_FUNCTIONS
61 FlParseInputPathname (
66 /*******************************************************************************
74 * DESCRIPTION: Dump the error log and abort the compiler. Used for serious
77 ******************************************************************************/
84 AePrintErrorLog (ASL_FILE_STDERR);
87 /* Print error summary to stdout also */
89 AePrintErrorLog (ASL_FILE_STDOUT);
96 /*******************************************************************************
98 * FUNCTION: FlFileError
100 * PARAMETERS: FileId - Index into file info array
101 * ErrorId - Index into error message array
105 * DESCRIPTION: Decode errno to an error message and add the entire error
108 ******************************************************************************/
116 sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename,
118 AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
122 /*******************************************************************************
124 * FUNCTION: FlOpenFile
126 * PARAMETERS: FileId - Index into file info array
127 * Filename - file pathname to open
128 * Mode - Open mode for fopen
132 * DESCRIPTION: Open a file.
133 * NOTE: Aborts compiler on any error.
135 ******************************************************************************/
146 File = fopen (Filename, Mode);
148 Gbl_Files[FileId].Filename = Filename;
149 Gbl_Files[FileId].Handle = File;
153 FlFileError (FileId, ASL_MSG_OPEN);
159 /*******************************************************************************
161 * FUNCTION: FlGetFileSize
163 * PARAMETERS: FileId - Index into file info array
167 * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
169 ******************************************************************************/
180 fp = Gbl_Files[FileId].Handle;
183 fseek (fp, 0, SEEK_END);
184 FileSize = (UINT32) ftell (fp);
186 /* Restore file pointer */
188 fseek (fp, Offset, SEEK_SET);
193 /*******************************************************************************
195 * FUNCTION: FlReadFile
197 * PARAMETERS: FileId - Index into file info array
198 * Buffer - Where to place the data
199 * Length - Amount to read
201 * RETURN: Status. AE_ERROR indicates EOF.
203 * DESCRIPTION: Read data from an open file.
204 * NOTE: Aborts compiler on any error.
206 ******************************************************************************/
217 /* Read and check for error */
219 Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle);
220 if (Actual != Length)
222 if (feof (Gbl_Files[FileId].Handle))
224 /* End-of-file, just return error */
229 FlFileError (FileId, ASL_MSG_READ);
237 /*******************************************************************************
239 * FUNCTION: FlWriteFile
241 * PARAMETERS: FileId - Index into file info array
242 * Buffer - Data to write
243 * Length - Amount of data to write
247 * DESCRIPTION: Write data to an open file.
248 * NOTE: Aborts compiler on any error.
250 ******************************************************************************/
261 /* Write and check for error */
263 Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle);
264 if (Actual != Length)
266 FlFileError (FileId, ASL_MSG_WRITE);
272 /*******************************************************************************
274 * FUNCTION: FlPrintFile
276 * PARAMETERS: FileId - Index into file info array
277 * Format - Printf format string
278 * ... - Printf arguments
282 * DESCRIPTION: Formatted write to an open file.
283 * NOTE: Aborts compiler on any error.
285 ******************************************************************************/
297 va_start (Args, Format);
299 Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args);
304 FlFileError (FileId, ASL_MSG_WRITE);
310 /*******************************************************************************
312 * FUNCTION: FlSeekFile
314 * PARAMETERS: FileId - Index into file info array
315 * Offset - Absolute byte offset in file
319 * DESCRIPTION: Seek to absolute offset
320 * NOTE: Aborts compiler on any error.
322 ******************************************************************************/
332 Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET);
335 FlFileError (FileId, ASL_MSG_SEEK);
341 /*******************************************************************************
343 * FUNCTION: FlCloseFile
345 * PARAMETERS: FileId - Index into file info array
349 * DESCRIPTION: Close an open file. Aborts compiler on error
351 ******************************************************************************/
360 if (!Gbl_Files[FileId].Handle)
365 Error = fclose (Gbl_Files[FileId].Handle);
368 FlFileError (FileId, ASL_MSG_CLOSE);
372 Gbl_Files[FileId].Handle = NULL;
377 /*******************************************************************************
379 * FUNCTION: FlSetLineNumber
381 * PARAMETERS: Op - Parse node for the LINE asl statement
385 * DESCRIPTION: Set the current line number
387 ******************************************************************************/
394 DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New line number %u (old %u)\n",
395 LineNumber, Gbl_LogicalLineNumber);
397 Gbl_CurrentLineNumber = LineNumber;
398 Gbl_LogicalLineNumber = LineNumber;
402 /*******************************************************************************
404 * FUNCTION: FlSetFilename
406 * PARAMETERS: Op - Parse node for the LINE asl statement
410 * DESCRIPTION: Set the current filename
412 ******************************************************************************/
419 DbgPrint (ASL_PARSE_OUTPUT, "\n#line: New filename %s (old %s)\n",
420 Filename, Gbl_Files[ASL_FILE_INPUT].Filename);
422 Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
426 /*******************************************************************************
428 * FUNCTION: FlAddIncludeDirectory
430 * PARAMETERS: Dir - Directory pathname string
434 * DESCRIPTION: Add a directory the list of include prefix directories.
436 ******************************************************************************/
439 FlAddIncludeDirectory (
442 ASL_INCLUDE_DIR *NewDir;
443 ASL_INCLUDE_DIR *NextDir;
444 ASL_INCLUDE_DIR *PrevDir = NULL;
445 UINT32 NeedsSeparator = 0;
449 DirLength = strlen (Dir);
455 /* Make sure that the pathname ends with a path separator */
457 if ((Dir[DirLength-1] != '/') &&
458 (Dir[DirLength-1] != '\\'))
463 NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR));
464 NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator);
465 strcpy (NewDir->Dir, Dir);
468 strcat (NewDir->Dir, "/");
472 * Preserve command line ordering of -I options by adding new elements
473 * at the end of the list
475 NextDir = Gbl_IncludeDirList;
479 NextDir = NextDir->Next;
484 PrevDir->Next = NewDir;
488 Gbl_IncludeDirList = NewDir;
493 /*******************************************************************************
495 * FUNCTION: FlMergePathnames
497 * PARAMETERS: PrefixDir - Prefix directory pathname. Can be NULL or
498 * a zero length string.
499 * FilePathname - The include filename from the source ASL.
501 * RETURN: Merged pathname string
503 * DESCRIPTION: Merge two pathnames that (probably) have common elements, to
504 * arrive at a minimal length string. Merge can occur if the
505 * FilePathname is relative to the PrefixDir.
507 ******************************************************************************/
519 DbgPrint (ASL_PARSE_OUTPUT, "Include: Prefix path - \"%s\"\n"
520 "Include: FilePathname - \"%s\"\n",
521 PrefixDir, FilePathname);
524 * If there is no prefix directory or if the file pathname is absolute,
525 * just return the original file pathname
527 if (!PrefixDir || (!*PrefixDir) ||
528 (*FilePathname == '/') ||
529 (FilePathname[1] == ':'))
531 Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1);
532 strcpy (Pathname, FilePathname);
533 goto ConvertBackslashes;
536 /* Need a local copy of the prefix directory path */
538 CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1);
539 strcpy (CommonPath, PrefixDir);
542 * Walk forward through the file path, and simultaneously backward
543 * through the prefix directory path until there are no more
544 * relative references at the start of the file path.
546 while (*FilePathname && (!strncmp (FilePathname, "../", 3)))
548 /* Remove last element of the prefix directory path */
550 LastElement = strrchr (CommonPath, '/');
553 goto ConcatenatePaths;
556 *LastElement = 0; /* Terminate CommonPath string */
557 FilePathname += 3; /* Point to next path element */
561 * Remove the last element of the prefix directory path (it is the same as
562 * the first element of the file pathname), and build the final merged
565 LastElement = strrchr (CommonPath, '/');
571 /* Build the final merged pathname */
574 Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2);
575 if (LastElement && *CommonPath)
577 strcpy (Pathname, CommonPath);
578 strcat (Pathname, "/");
580 strcat (Pathname, FilePathname);
581 ACPI_FREE (CommonPath);
583 /* Convert all backslashes to normal slashes */
586 UtConvertBackslashes (Pathname);
588 DbgPrint (ASL_PARSE_OUTPUT, "Include: Merged Pathname - \"%s\"\n",
594 /*******************************************************************************
596 * FUNCTION: FlOpenIncludeWithPrefix
598 * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero
600 * Filename - The include filename from the source ASL.
602 * RETURN: Valid file descriptor if successful. Null otherwise.
604 * DESCRIPTION: Open an include file and push it on the input file stack.
606 ******************************************************************************/
609 FlOpenIncludeWithPrefix (
617 /* Build the full pathname to the file */
619 Pathname = FlMergePathnames (PrefixDir, Filename);
621 DbgPrint (ASL_PARSE_OUTPUT, "Include: Opening file - \"%s\"\n\n",
624 /* Attempt to open the file, push if successful */
626 IncludeFile = fopen (Pathname, "r");
629 /* Push the include file on the open input file stack */
631 AslPushInputFileStack (IncludeFile, Pathname);
632 return (IncludeFile);
635 ACPI_FREE (Pathname);
640 /*******************************************************************************
642 * FUNCTION: FlOpenIncludeFile
644 * PARAMETERS: Op - Parse node for the INCLUDE ASL statement
648 * DESCRIPTION: Open an include file and push it on the input file stack.
650 ******************************************************************************/
654 ACPI_PARSE_OBJECT *Op)
657 ASL_INCLUDE_DIR *NextDir;
660 /* Op must be valid */
664 AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN,
665 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
666 Gbl_InputByteCount, Gbl_CurrentColumn,
667 Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node");
673 * Flush out the "include ()" statement on this line, start
674 * the actual include file on the next line
676 AslResetCurrentLineBuffer ();
677 FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n");
678 Gbl_CurrentLineOffset++;
681 /* Attempt to open the include file */
683 /* If the file specifies an absolute path, just open it */
685 if ((Op->Asl.Value.String[0] == '/') ||
686 (Op->Asl.Value.String[0] == '\\') ||
687 (Op->Asl.Value.String[1] == ':'))
689 IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String);
698 * The include filename is not an absolute path.
700 * First, search for the file within the "local" directory -- meaning
701 * the same directory that contains the source file.
703 * Construct the file pathname from the global directory name.
705 IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String);
712 * Second, search for the file within the (possibly multiple) directories
713 * specified by the -I option on the command line.
715 NextDir = Gbl_IncludeDirList;
718 IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String);
724 NextDir = NextDir->Next;
727 /* We could not open the include file after trying very hard */
730 sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno));
731 AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer);
735 /*******************************************************************************
737 * FUNCTION: FlOpenInputFile
739 * PARAMETERS: InputFilename - The user-specified ASL source file to be
744 * DESCRIPTION: Open the specified input file, and save the directory path to
745 * the file so that include files can be opened in
746 * the same directory.
748 ******************************************************************************/
755 /* Open the input ASL file, text mode */
757 FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt");
758 AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle;
764 /*******************************************************************************
766 * FUNCTION: FlOpenAmlOutputFile
768 * PARAMETERS: FilenamePrefix - The user-specified ASL source file
772 * DESCRIPTION: Create the output filename (*.AML) and open the file. The file
773 * is created in the same directory as the parent input file.
775 ******************************************************************************/
778 FlOpenAmlOutputFile (
779 char *FilenamePrefix)
784 /* Output filename usually comes from the ASL itself */
786 Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename;
789 /* Create the output AML filename */
791 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE);
794 AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME,
795 0, 0, 0, 0, NULL, NULL);
800 /* Open the output AML file in binary mode */
802 FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b");
807 /*******************************************************************************
809 * FUNCTION: FlOpenMiscOutputFiles
811 * PARAMETERS: FilenamePrefix - The user-specified ASL source file
815 * DESCRIPTION: Create and open the various output files needed, depending on
816 * the command line options
818 ******************************************************************************/
821 FlOpenMiscOutputFiles (
822 char *FilenamePrefix)
827 /* Create/Open a hex output file if asked */
829 if (Gbl_HexOutputFlag)
831 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
834 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
835 0, 0, 0, 0, NULL, NULL);
839 /* Open the hex file, text mode */
841 FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+t");
843 AslCompilerSignon (ASL_FILE_HEX_OUTPUT);
844 AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT);
847 /* Create/Open a debug output file if asked */
851 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
854 AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
855 0, 0, 0, 0, NULL, NULL);
859 /* Open the debug file as STDERR, text mode */
861 /* TBD: hide this behind a FlReopenFile function */
863 Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
864 Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
865 freopen (Filename, "w+t", stderr);
867 if (!Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle)
869 AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
870 0, 0, 0, 0, NULL, NULL);
874 AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
875 AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
878 /* Create/Open a listing output file if asked */
882 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING);
885 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
886 0, 0, 0, 0, NULL, NULL);
890 /* Open the listing file, text mode */
892 FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+t");
894 AslCompilerSignon (ASL_FILE_LISTING_OUTPUT);
895 AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT);
898 /* Create the preprocessor output file if preprocessor enabled */
900 if (Gbl_PreprocessFlag)
902 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_PREPROCESSOR);
905 AslCommonError (ASL_ERROR, ASL_MSG_PREPROCESSOR_FILENAME,
906 0, 0, 0, 0, NULL, NULL);
910 FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t");
913 /* All done for data table compiler */
915 if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
920 /* Create/Open a combined source output file */
922 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
925 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
926 0, 0, 0, 0, NULL, NULL);
931 * Open the source output file, binary mode (so that LF does not get
932 * expanded to CR/LF on some systems, messing up our seek
935 FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b");
939 // AslCompilerin = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
941 /* Create/Open a assembly code source output file if asked */
943 if (Gbl_AsmOutputFlag)
945 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE);
948 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
949 0, 0, 0, 0, NULL, NULL);
953 /* Open the assembly code source file, text mode */
955 FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+t");
957 AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT);
958 AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT);
961 /* Create/Open a C code source output file if asked */
963 if (Gbl_C_OutputFlag)
965 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE);
968 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
969 0, 0, 0, 0, NULL, NULL);
973 /* Open the C code source file, text mode */
975 FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+t");
977 FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n");
978 AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT);
979 AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT);
982 /* Create/Open a assembly include output file if asked */
984 if (Gbl_AsmIncludeOutputFlag)
986 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE);
989 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
990 0, 0, 0, 0, NULL, NULL);
994 /* Open the assembly include file, text mode */
996 FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+t");
998 AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT);
999 AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT);
1002 /* Create/Open a C include output file if asked */
1004 if (Gbl_C_IncludeOutputFlag)
1006 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE);
1009 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
1010 0, 0, 0, 0, NULL, NULL);
1014 /* Open the C include file, text mode */
1016 FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+t");
1018 FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n");
1019 AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT);
1020 AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT);
1023 /* Create a namespace output file if asked */
1025 if (Gbl_NsOutputFlag)
1027 Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE);
1030 AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
1031 0, 0, 0, 0, NULL, NULL);
1035 /* Open the namespace file, text mode */
1037 FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+t");
1039 AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT);
1040 AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT);
1047 #ifdef ACPI_OBSOLETE_FUNCTIONS
1048 /*******************************************************************************
1050 * FUNCTION: FlParseInputPathname
1052 * PARAMETERS: InputFilename - The user-specified ASL source file to be
1057 * DESCRIPTION: Split the input path into a directory and filename part
1058 * 1) Directory part used to open include files
1059 * 2) Filename part used to generate output filenames
1061 ******************************************************************************/
1064 FlParseInputPathname (
1065 char *InputFilename)
1075 /* Get the path to the input filename's directory */
1077 Gbl_DirectoryPath = strdup (InputFilename);
1078 if (!Gbl_DirectoryPath)
1080 return (AE_NO_MEMORY);
1083 Substring = strrchr (Gbl_DirectoryPath, '\\');
1086 Substring = strrchr (Gbl_DirectoryPath, '/');
1089 Substring = strrchr (Gbl_DirectoryPath, ':');
1095 Gbl_DirectoryPath[0] = 0;
1096 if (Gbl_UseDefaultAmlFilename)
1098 Gbl_OutputFilenamePrefix = strdup (InputFilename);
1103 if (Gbl_UseDefaultAmlFilename)
1105 Gbl_OutputFilenamePrefix = strdup (Substring + 1);