Beispiel #1
0
static Segment* NewSegment (const char* Name, unsigned char AddrSize)
/* Create a new segment, insert it into the global list and return it */
{
    /* Check for too many segments */
    if (CollCount (&SegmentList) >= 256) {
     	Fatal ("Too many segments");
    }

    /* Check the segment name for invalid names */
    if (!ValidSegName (Name)) {
     	Error ("Illegal segment name: `%s'", Name);
    }

    /* Create a new segment and return it */
    return NewSegFromDef (NewSegDef (Name, AddrSize));
}
Beispiel #2
0
static Segment* NewSegment (const char* Name, unsigned char AddrSize)
/* Create a new segment, insert it into the global list and return it */
{
    Segment* S;

    /* Check for too many segments */
    if (SegmentCount >= 256) {
     	Fatal ("Too many segments");
    }

    /* Check the segment name for invalid names */
    if (!ValidSegName (Name)) {
     	Error ("Illegal segment name: `%s'", Name);
    }

    /* Create a new segment */
    S = xmalloc (sizeof (*S));

    /* Initialize it */
    S->List      = 0;
    S->Root      = 0;
    S->Last      = 0;
    S->FragCount = 0;
    S->Num       = SegmentCount++;
    S->Align     = 0;
    S->RelocMode = 1;
    S->PC        = 0;
    S->AbsPC     = 0;
    S->Def       = NewSegDef (Name, AddrSize);

    /* Insert it into the segment list */
    SegmentLast->List = S;
    SegmentLast = S;

    /* And return it... */
    return S;
}