From: ggn Date: Thu, 27 Apr 2017 07:24:37 +0000 (+0300) Subject: Added -l* to enable listing without pagination. Fix bug where a wrong malloc would... X-Git-Tag: v2.1.0~129 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=commitdiff_plain;h=ba392fd1c677a8aeb55cbaf81bc529f16c02e804;hp=9207a38ed4a09c60a1e9b9995a92bcd4580e3662 Added -l* to enable listing without pagination. Fix bug where a wrong malloc would lead to explosions with listing enabled. --- diff --git a/Vs2015/rmac/rmac.vcxproj b/Vs2015/rmac/rmac.vcxproj index a127bd8..d544059 100644 --- a/Vs2015/rmac/rmac.vcxproj +++ b/Vs2015/rmac/rmac.vcxproj @@ -19,6 +19,7 @@ + @@ -38,6 +39,7 @@ + @@ -114,7 +116,7 @@ true - $(SolutionDir)\.. + $(SolutionDir)..\ false diff --git a/Vs2015/rmac/rmac.vcxproj.user b/Vs2015/rmac/rmac.vcxproj.user deleted file mode 100644 index abe8dd8..0000000 --- a/Vs2015/rmac/rmac.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/listing.c b/listing.c index 68d6c6f..68f75b7 100644 --- 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 77c37e7..e4bd7b7 100644 --- 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 e2e677f..00eba54 100644 --- 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; diff --git a/symbol.c b/symbol.c index f2f513c..b89cd80 100644 --- 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;