OSDN Git Service

- Version bumped ACC to 1.47.
[zandronum/zandronum-acc.git] / token.c
diff --git a/token.c b/token.c
index 1c2ae41..bc19cc9 100644 (file)
--- a/token.c
+++ b/token.c
@@ -320,10 +320,10 @@ void TK_AddIncludePath(char *sourcePath)
                strcpy(IncludePaths[NumIncludePaths], sourcePath);\r
                \r
                // Not ending with directory delimiter?\r
-               if(*(IncludePaths[NumIncludePaths] + strlen(IncludePaths[NumIncludePaths]) - 1) != DIRECTORY_DELIMITER_CHAR)\r
+               if(!MS_IsDirectoryDelimiter(*(IncludePaths[NumIncludePaths] + strlen(IncludePaths[NumIncludePaths]) - 1)))\r
                {\r
                        // Add a directory delimiter to the include path\r
-                       strcat(IncludePaths[NumIncludePaths], DIRECTORY_DELIMITER);\r
+                       strcat(IncludePaths[NumIncludePaths], "/");\r
                }\r
                NumIncludePaths++;\r
        }\r
@@ -346,11 +346,6 @@ static void SetLocalIncludePath(char *sourceName)
        {\r
                IncludePaths[0][0] = 0;\r
        }\r
-       else\r
-       {\r
-               // Add a directory delimiter to the include path\r
-               strcat(IncludePaths[0], DIRECTORY_DELIMITER);\r
-       }\r
 }\r
 \r
 \r
@@ -386,7 +381,24 @@ void TK_Include(char *fileName)
        // Handle absolute paths\r
        if(MS_IsPathAbsolute(fileName))\r
        {\r
+#if defined(_WIN32) || defined(__MSDOS__)\r
+               sourceName[0] = '\0';\r
+               if(MS_IsDirectoryDelimiter(fileName[0]))\r
+               {\r
+                       // The source file is absolute for the drive, but does not\r
+                       // specify a drive. Use the path for the current file to\r
+                       // get the drive letter, if it has one.\r
+                       if(IncludePaths[0][0] != '\0' && IncludePaths[0][1] == ':')\r
+                       {\r
+                               sourceName[0] = IncludePaths[0][0];\r
+                               sourceName[1] = ':';\r
+                               sourceName[2] = '\0';\r
+                       }\r
+               }\r
+               strcat(sourceName, fileName);\r
+#else\r
                strcpy(sourceName, fileName);\r
+#endif\r
                foundfile = MS_FileExists(sourceName);\r
        }\r
        else\r
@@ -410,7 +422,9 @@ void TK_Include(char *fileName)
                ERR_ErrorAt(tk_SourceName, tk_Line);\r
                ERR_Exit(ERR_CANT_FIND_INCLUDE, YES, fileName, tk_SourceName, tk_Line);\r
        }\r
-       \r
+\r
+       MS_Message(MSG_DEBUG, "*Include file found at %s\n", sourceName);\r
+\r
        // Now change the first include path to the file directory\r
        SetLocalIncludePath(sourceName);\r
        \r
@@ -1018,8 +1032,8 @@ static void ProcessQuoteToken(void)
                        *text++ = Chr;\r
                }\r
                // escape the character after a backslash [JB]\r
-               if(Chr == ASCII_BACKSLASH)\r
-                       escaped ^= (Chr == ASCII_BACKSLASH);\r
+               if(Chr == '\\')\r
+                       escaped ^= (Chr == '\\');\r
                else\r
                        escaped = FALSE;\r
                NextChr();\r