X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Ffragment.c;h=3a9e13c7365351609f64259f5f58a74b33efb7e3;hb=35e1184901ca38bdb2e56d154ed3b71f6096eacc;hp=65f10bed0f86b6d3a6c042888405a019916a78bd;hpb=edde7a3f453ae863d958d6b8db0a95e1062bfe77;p=cc65 diff --git a/src/ld65/fragment.c b/src/ld65/fragment.c index 65f10bed0..3a9e13c73 100644 --- a/src/ld65/fragment.c +++ b/src/ld65/fragment.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 1998-2011, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -39,11 +39,9 @@ /* ld65 */ #include "error.h" -#include "expr.h" #include "fragment.h" -#include "fileio.h" +#include "objdata.h" #include "segments.h" -#include "spool.h" @@ -53,56 +51,6 @@ -static FragCheck* NewFragCheck (unsigned Action) -/* Allocate a new FragCheck struct and return it */ -{ - /* Allocate memory */ - FragCheck* FC = xmalloc (sizeof (FragCheck)); - - /* Initialize the fields */ - FC->Next = 0; - FC->Expr = 0; - FC->Action = Action; - FC->Message = INVALID_STRING_ID; - - /* Return the new struct */ - return FC; -} - - - -FragCheck* ReadFragCheck (FILE* F, Fragment* Frag) -/* Read a fragment check expression from the given file */ -{ - /* Get the object file pointer from the fragment */ - ObjData* O = Frag->Obj; - - /* Read the action and create a new struct */ - FragCheck* FC = NewFragCheck (ReadVar (F)); - - /* Determine the remaining data from the action */ - switch (FC->Action) { - - case FRAG_ACT_WARN: - case FRAG_ACT_ERROR: - FC->Expr = ReadExpr (F, O); - FC->Message = MakeGlobalStringId (O, ReadVar (F)); - break; - - default: - Internal ("In module `%s', file `%s', line %lu: Invalid fragment " - "check action: %u", - GetObjFileName (O), - GetSourceFileName (O, Frag->Pos.Name), - Frag->Pos.Line, FC->Action); - } - - /* Return the new fragment check */ - return FC; -} - - - Fragment* NewFragment (unsigned char Type, unsigned Size, Section* S) /* Create a new fragment and insert it into the section S */ { @@ -122,11 +70,10 @@ Fragment* NewFragment (unsigned char Type, unsigned Size, Section* S) /* Initialize the data */ F->Next = 0; F->Obj = 0; + F->Sec = S; F->Size = Size; F->Expr = 0; - InitFilePos (&F->Pos); - F->LI = 0; - F->Check = 0; + F->LineInfos = EmptyCollection; F->Type = Type; /* Insert the code fragment into the section */