Added -l* to enable listing without pagination. Fix bug where a wrong malloc would...
authorggn <ggn.dbug@gmail.com>
Thu, 27 Apr 2017 07:24:37 +0000 (10:24 +0300)
committerShamus Hammons <jlhamm@acm.org>
Thu, 27 Apr 2017 13:06:49 +0000 (08:06 -0500)
Vs2015/rmac/rmac.vcxproj
Vs2015/rmac/rmac.vcxproj.user [deleted file]
listing.c
rmac.c
rmac.h
symbol.c

index a127bd8f874fb7c054a7b5ecc383ec28529ef3ff..d544059d84a8cf1c7587e915ba65973718ae1086 100644 (file)
@@ -19,6 +19,7 @@
     </ProjectConfiguration>
   </ItemGroup>
   <ItemGroup>
+    <ClCompile Include="..\..\6502.c" />
     <ClCompile Include="..\..\amode.c" />
     <ClCompile Include="..\..\debug.c" />
     <ClCompile Include="..\..\direct.c" />
@@ -38,6 +39,7 @@
     <ClCompile Include="..\..\token.c" />
   </ItemGroup>
   <ItemGroup>
+    <ClInclude Include="..\..\6502.h" />
     <ClInclude Include="..\..\amode.h" />
     <ClInclude Include="..\..\debug.h" />
     <ClInclude Include="..\..\direct.h" />
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <LinkIncremental>true</LinkIncremental>
-    <OutDir>$(SolutionDir)\..</OutDir>
+    <OutDir>$(SolutionDir)..\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
diff --git a/Vs2015/rmac/rmac.vcxproj.user b/Vs2015/rmac/rmac.vcxproj.user
deleted file mode 100644 (file)
index abe8dd8..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup />
-</Project>
\ No newline at end of file
index 68d6c6f42141ad952bb4d841e94c8eb2693d3b52..68f75b7068b1e2f6deaf55efa0ee0f947d779c3c 100644 (file)
--- a/listing.c
+++ b/listing.c
@@ -217,27 +217,30 @@ void ship_ln(const char * ln)
        if (listing <= 0)
                return;
 
-       // Notice bottom of page
-       if (nlines >= pagelen - BOT_MAR)
-               eject();
-
-       // Print title, boilerplate, and subtitle at top of page
-       if (nlines == 0)
-       {
-               pageno++;
-               println("");
-               date_string(datestr, dos_date());
-               time_string(timestr, dos_time());
-               sprintf(buf,
-                       "%-40s%-20s Page %-4d    %s %s        RMAC %01i.%01i.%02i (%s)",
-                       title, curfname, pageno, timestr, datestr, MAJOR, MINOR, PATCH,
-                       PLATFORM);
-               println(buf);
-               sprintf(buf, "%s", subttl);
-               println(buf);
-               println("");
-               nlines = 4;
-       }
+    if (list_pag)
+    {
+        // Notice bottom of page
+        if (nlines >= pagelen - BOT_MAR)
+            eject();
+
+        // Print title, boilerplate, and subtitle at top of page
+        if (nlines == 0)
+        {
+            pageno++;
+            println("");
+            date_string(datestr, dos_date());
+            time_string(timestr, dos_time());
+            sprintf(buf,
+                "%-40s%-20s Page %-4d    %s %s        RMAC %01i.%01i.%02i (%s)",
+                title, curfname, pageno, timestr, datestr, MAJOR, MINOR, PATCH,
+                PLATFORM);
+            println(buf);
+            sprintf(buf, "%s", subttl);
+            println(buf);
+            println("");
+            nlines = 4;
+        }
+    }
 
        println(ln);
        nlines++;
diff --git a/rmac.c b/rmac.c
index 77c37e710b4099291a02eef51dc61a1976be9854..e4bd7b78091578f475343a88806a339782210fad 100644 (file)
--- a/rmac.c
+++ b/rmac.c
@@ -25,6 +25,7 @@
 
 int perm_verb_flag;                            // Permanently verbose, interactive mode
 int list_flag;                                 // "-l" listing flag on command line
+int list_pag = 1;               // Enable listing pagination by default
 int verb_flag;                                 // Be verbose about what's going on
 int m6502;                                             // 1, assembling 6502 code
 int as68_flag;                                 // as68 kludge mode
@@ -134,6 +135,7 @@ void DisplayHelp(void)
                "                    x: com/exe/xex (Atari 800)\n"
                "  -i[path]          Directory to search for include files\n"
                "  -l[filename]      Create an output listing file\n"
+        "  -l*[filename]     Create an output listing file without pagination\n"
                "  -n                Don't do things behind your back in RISC assembler\n"
                "  -o file           Output file name\n"
                "  +o[value]         Turn a specific optimisation on\n"
@@ -343,7 +345,15 @@ int Process(int argc, char ** argv)
                                break;
                        case 'l':                               // Produce listing file
                        case 'L':
-                               list_fname = argv[argno] + 2;
+                if (*(argv[argno] + 2) == '*')
+                {
+                    list_fname = argv[argno] + 3;
+                    list_pag = 0;    // Special case - turn off pagination
+                }
+                else
+                {
+                    list_fname = argv[argno] + 2;
+                }
                                listing = 1;
                                list_flag = 1;
                                lnsave++;
diff --git a/rmac.h b/rmac.h
index e2e677f63346d778518553b287818bbb27933483..00eba54f16c1dd632852c738f2436d7d04159cf9 100644 (file)
--- a/rmac.h
+++ b/rmac.h
@@ -265,6 +265,7 @@ extern int err_fd;
 extern int regbank;
 extern char * firstfname;
 extern int list_fd;
+extern int list_pag;
 extern int as68_flag;
 extern int m6502;
 extern int list_flag;
index f2f513cc3671aa0ca652d7be9f300c40fd8281d4..b89cd8091587571de30190d93d932a025fe6ce36 100644 (file)
--- a/symbol.c
+++ b/symbol.c
@@ -400,7 +400,7 @@ int symtable(void)
 
        // Allocate storage for list headers and partition all labels. Throw away
        // macros and macro arguments.
-       SYM ** sy = (SYM **)malloc(128 * sizeof(uint32_t));
+       SYM ** sy = (SYM **)malloc(128 * sizeof(SYM **));
 
        for(i=0; i<128; i++)
                sy[i] = NULL;