X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcc65%2Ftextseg.c;h=cbb393b50a55c8233d0e3d271eb53498cd8c37c8;hb=f266612697b213f2f74027eb5b2605b19a97d6d7;hp=3ca44990eac271b5123490caeba25cfca101f0af;hpb=d27bfe8a7b00dddef501ae9ce73e398c068be7c4;p=cc65 diff --git a/src/cc65/textseg.c b/src/cc65/textseg.c index 3ca44990e..cbb393b50 100644 --- a/src/cc65/textseg.c +++ b/src/cc65/textseg.c @@ -1,15 +1,15 @@ /*****************************************************************************/ /* */ -/* textseg.c */ +/* textseg.c */ /* */ -/* Text segment structure */ +/* Text segment structure */ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@cc65.org */ +/* (C) 2001-2009, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -44,12 +44,13 @@ #include "xsprintf.h" /* cc65 */ +#include "output.h" #include "textseg.h" /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -58,10 +59,10 @@ TextSeg* NewTextSeg (SymEntry* Func) /* Create a new text segment, initialize and return it */ { /* Allocate memory for the structure */ - TextSeg* S = xmalloc (sizeof (TextSeg)); + TextSeg* S = xmalloc (sizeof (TextSeg)); /* Initialize the fields */ - S->Func = Func; + S->Func = Func; InitCollection (&S->Lines); /* Return the new struct */ @@ -70,7 +71,7 @@ TextSeg* NewTextSeg (SymEntry* Func) -void TS_AddLine (TextSeg* S, const char* Format, va_list ap) +void TS_AddVLine (TextSeg* S, const char* Format, va_list ap) /* Add a line to the given text segment */ { /* Format the line */ @@ -83,8 +84,19 @@ void TS_AddLine (TextSeg* S, const char* Format, va_list ap) -void TS_Output (const TextSeg* S, FILE* F) -/* Output the text segment data to a file */ +void TS_AddLine (TextSeg* S, const char* Format, ...) +/* Add a line to the given text segment */ +{ + va_list ap; + va_start (ap, Format); + TS_AddVLine (S, Format, ap); + va_end (ap); +} + + + +void TS_Output (const TextSeg* S) +/* Output the text segment data to the output file */ { unsigned I; @@ -93,17 +105,14 @@ void TS_Output (const TextSeg* S, FILE* F) /* If the segment is actually empty, bail out */ if (Count == 0) { - return; + return; } /* Output all entries */ for (I = 0; I < Count; ++I) { - fprintf (F, "%s\n", (const char*) CollConstAt (&S->Lines, I)); + WriteOutput ("%s\n", (const char*) CollConstAt (&S->Lines, I)); } /* Add an additional newline after the segment output */ - fprintf (F, "\n"); + WriteOutput ("\n"); } - - -