]> Shamusworld >> Repos - rmac/commitdiff
.incbin now uses the same directory sets as .include. Also some small cosmetic fixes.
authorggn <ggn.dbug@gmail.com>
Tue, 13 Sep 2016 16:48:44 +0000 (19:48 +0300)
committerShamus Hammons <jlhamm@acm.org>
Tue, 27 Sep 2016 15:38:51 +0000 (10:38 -0500)
Vs2015/rmac/rmac.vcxproj
direct.c
mark.c

index a127bd8f874fb7c054a7b5ecc383ec28529ef3ff..e03e65d6fa0d2ed53a9ee57dcc4569912cdd3d10 100644 (file)
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
-    <OutDir>$(SolutionDir)\..</OutDir>
+    <OutDir>$(SolutionDir)\..\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
index dc44e8e62371b5b5eb72229801c8800bd347fdf6..dc9747ba9174fd05d3bf61d3a21955aa00ab5fc2 100644 (file)
--- a/direct.c
+++ b/direct.c
@@ -350,6 +350,8 @@ int d_incbin(void)
        int bytes = 0;
        long pos, size, bytesRead;
        char msg[256];
        int bytes = 0;
        long pos, size, bytesRead;
        char msg[256];
+       char buf1[256];
+       int i;
 
        // Check to see if we're in BSS, and, if so, throw an error
        if (scattr & SBSS)
 
        // Check to see if we're in BSS, and, if so, throw an error
        if (scattr & SBSS)
@@ -364,12 +366,30 @@ int d_incbin(void)
                return ERROR;
        }
 
                return ERROR;
        }
 
-       if ((fd = open(string[tok[1]],  _OPEN_INC)) < 0)
+       // Attempt to open the include file in the current directory, then (if that
+       // failed) try list of include files passed in the enviroment string or by
+       // the "-d" option.
+       if ((fd = open(string[tok[1]], _OPEN_INC)) < 0)
        {
        {
-               errors("cannot open include binary file (%s)", string[tok[1]]);
-               return ERROR;
+               for (i = 0; nthpath("RMACPATH", i, buf1) != 0; i++)
+               {
+                       fd = strlen(buf1);
+
+                       if (fd > 0 && buf1[fd - 1] != SLASHCHAR)        // Append path char if necessary
+                               strcat(buf1, SLASHSTRING);
+
+                       strcat(buf1, string[tok[1]]);
+
+                       if ((fd = open(buf1, _OPEN_INC)) >= 0)
+                               goto allright;
+               }
+
+               return errors("cannot open: \"%s\"", string[tok[1]]);
        }
 
        }
 
+allright:
+
+
        size = lseek(fd, 0L, SEEK_END);
        pos = lseek(fd, 0L, SEEK_SET);
        chcheck(size);
        size = lseek(fd, 0L, SEEK_END);
        pos = lseek(fd, 0L, SEEK_SET);
        chcheck(size);
diff --git a/mark.c b/mark.c
index d593b21d6997adda8fbf45015fb0672bd48e586d..81a4d87293bf6b596171641f43e47bae5fc66fc1 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -18,6 +18,7 @@ PTR markptr;                  // Deposit point in current mark chunk
 LONG mcalloc;                  // #bytes alloc'd to current mark chunk
 LONG mcused;                   // #bytes used in current mark chunk
 uint16_t curfrom;              // Current "from" section
 LONG mcalloc;                  // #bytes alloc'd to current mark chunk
 LONG mcused;                   // #bytes used in current mark chunk
 uint16_t curfrom;              // Current "from" section
+LONG markimg(register char * mp, LONG siz, LONG tsize, int okflag);
 
 //
 //  Imports
 
 //
 //  Imports