1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
%{
#include "wisebase.h"
%}
%{
#include "wiseoverlay.h"
static boolean isinuse=FALSE;
static FILE * overlay = NULL;
static int delete_len=0;
%func
actually starts on overlay system
on the FILE*. Should really by stderr...
nothing else makes sense.
%%
void start_overlay(FILE * over)
{
overlay=over;
isinuse=TRUE;
}
%func
finishes an overlay system by putting in a
newline and clearing the static variables
%%
void stop_overlay(void)
{
fprintf(overlay,"\n");
delete_len=0;
overlay=NULL;
isinuse=FALSE;
}
%func
Does the business. Deletes the previous
message with \b and then prints the current
one ontop.
don't put in \n's otherwise this is going to
look yukky ;)
%%
void print_overlay(char * msg, ... )
{
char buffer[512];
va_list ap;
register int i;
if( isinuse == FALSE)
/* error message */
return;
va_start(ap,msg);
for(i=0;i<delete_len;i++)
fputc('\b',overlay);
vsprintf(buffer,msg,ap);
delete_len=strlen(buffer);
fprintf(overlay,"%s",buffer);
fflush(overlay);
va_end(ap);
return;
}
%}
|