The line counter got confused for lines with more than 256 chars. Removed the

restriction alltogether, so lines with arbitrary length should be handled
correctly. Not that it is of much use for an assembler, but this has really
been a somewhat ancient limitation.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5072 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-07-07 20:07:29 +00:00
parent 9d7edad0cc
commit d18fd210aa
3 changed files with 84 additions and 45 deletions

View File

@@ -41,6 +41,7 @@
#include "check.h"
#include "fname.h"
#include "fragdefs.h"
#include "strbuf.h"
#include "version.h"
#include "xmalloc.h"
@@ -81,7 +82,7 @@ static int ListingEnabled = 1; /* Enabled if > 0 */
void NewListingLine (const char* Line, unsigned char File, unsigned char Depth)
void NewListingLine (const StrBuf* Line, unsigned char File, unsigned char Depth)
/* Create a new ListLine struct and insert it */
{
/* Store only if listing is enabled */
@@ -90,10 +91,10 @@ void NewListingLine (const char* Line, unsigned char File, unsigned char Depth)
ListLine* L;
/* Get the length of the line */
unsigned Len = strlen (Line);
unsigned Len = SB_GetLen (Line);
/* Ignore trailing newlines */
while (Len > 0 && Line[Len-1] == '\n') {
while (Len > 0 && SB_AtUnchecked (Line, Len-1) == '\n') {
--Len;
}
@@ -110,8 +111,8 @@ void NewListingLine (const char* Line, unsigned char File, unsigned char Depth)
L->Depth = Depth;
L->Output = (ListingEnabled > 0);
L->ListBytes = (unsigned char) ListBytes;
memcpy (L->Line, Line, Len);
L->Line [Len] = '\0';
memcpy (L->Line, SB_GetConstBuf (Line), Len);
L->Line[Len] = '\0';
/* Insert the line into the list of lines */
if (LineList == 0) {
@@ -303,8 +304,8 @@ void CreateListing (void)
/* Open the real listing file */
F = fopen (SB_GetConstBuf (&ListingName), "w");
if (F == 0) {
Fatal ("Cannot open listing file `%s': %s",
SB_GetConstBuf (&ListingName),
Fatal ("Cannot open listing file `%s': %s",
SB_GetConstBuf (&ListingName),
strerror (errno));
}