1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-08 19:38:55 +00:00

Fixed line info issues

git-svn-id: svn://svn.cc65.org/cc65/trunk@763 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-05-29 07:39:01 +00:00
parent 369f59c1bb
commit 45242a8e02
2 changed files with 15 additions and 22 deletions

View File

@ -166,8 +166,17 @@ static int CmpLineInfo (void* Data, const void* LI1_, const void* LI2_)
void MakeLineInfoIndex (void)
/* Sort the line infos and drop all unreferenced ones */
{
unsigned I;
/* Sort the collection */
CollSort (&LineInfoColl, CmpLineInfo, 0);
/* Walk over the list and index the line infos. */
for (I = 0; I < LineInfoValid; ++I) {
/* Get a pointer to this line info */
LineInfo* LI = CollAtUnchecked (&LineInfoColl, I);
LI->Index = I;
}
}
@ -203,6 +212,9 @@ void WriteLineInfo (void)
ObjWriteVar (0);
}
/* End of line infos */
ObjEndLineInfos ();
}

View File

@ -458,8 +458,6 @@ static void WriteOneSeg (Segment* Seg)
/* Write one segment to the object file */
{
Fragment* Frag;
Fragment* F;
unsigned long Size;
unsigned LineInfoIndex;
/* Write the segment name followed by the byte count in this segment */
@ -478,26 +476,9 @@ static void WriteOneSeg (Segment* Seg)
switch (Frag->Type) {
case FRAG_LITERAL:
/* To make the object file somewhat smaller, write all literal
* data of this and the following fragments preceeded by the
* length.
*/
F = Frag;
Size = 0;
while (F && F->Type == FRAG_LITERAL) {
Size += F->Len;
F = F->Next;
}
ObjWrite8 (FRAG_LITERAL);
ObjWriteVar (Size);
/* Now write the literal data */
F = Frag;
while (F && F->Type == FRAG_LITERAL) {
ObjWriteData (F->V.Data, F->Len);
Frag = F;
F = F->Next;
}
ObjWriteVar (Frag->Len);
ObjWriteData (Frag->V.Data, Frag->Len);
break;
case FRAG_EXPR:
@ -537,7 +518,7 @@ static void WriteOneSeg (Segment* Seg)
/* Write extra line info for this fragment. Zero is considered
* "no line info", so add one to the value.
*/
*/
LineInfoIndex = Frag->LI? Frag->LI->Index + 1 : 0;
ObjWriteVar (LineInfoIndex);