AcePerl
view release on metacpan or search on metacpan
acelib/freeout.c view on Meta::CPAN
else
out->pos += pos ;
out = out->next ;
}
}
static void freeMessOut (char* text)
{
freeOut ("// ") ;
freeOut (text) ;
freeOut ("\n") ;
}
/*************************************************************/
/* copy a binary structure onto a text stack */
void freeOutBinary (char *data, int size)
{
OUT *out = outCurr ;
if (out->fil)
fwrite(data,size,1,out->fil);
else if (out->s) {
catBinary (out->s,data,size);
/* acts like a newline was added */
out->pos = 0;
out->line++;
}
}
/*************************************************************/
void freeOutxy (char *text, int x, int y)
{ static Array buf = 0 ;
OUT *out = outCurr ;
int i, j, k = 0 ;
i = x - out->pos , j = y - out->line ;
if (i || j)
{ buf = arrayReCreate (buf, 100, char) ;
k = 0 ;
if (j > 0)
{ while (j--)
array (buf, k++, char) = '\n' ;
i = x ;
}
if (i < 0)
{ array (buf, k++, char) = '\n' ;
i = x ; out->line-- ; /* kludge, user should ignore this line feed */
}
if (i > 0)
{ while (i--)
array (buf, k++, char) = ' ' ;
}
array (buf, k++, char) = 0 ;
freeOut (arrp(buf, 0, char)) ;
}
freeOut (text) ;
}
/************************************************/
void freeOutf (char *format,...)
{
va_list args ;
stackClear (outBuf) ;
va_start (args,format) ;
vsprintf (stackText (outBuf,0), format,args) ;
va_end (args) ;
if (strlen(stackText (outBuf,0)) >= BUFSIZE)
messcrash ("abusing freeOutf with too long a string: \n%s",
outBuf) ;
freeOut (stackText (outBuf,0)) ;
}
/************************************************/
int freeOutLine (void)
{ return outCurr->line ; }
int freeOutByte (void)
{ return outCurr->byte ; }
int freeOutPos (void)
{ return outCurr->pos ; }
/************************************************/
/************************************************/
( run in 0.560 second using v1.01-cache-2.11-cpan-524268b4103 )