Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 3a0b3655 authored by deuce's avatar deuce
Browse files

Eliminate pputtext() and pgettext() in favour of vmem_puttext() and vmem_gettext()

Update scrollback to use vmem_gettext()
Update all the things I previously updated for the new cterm_init() prototype

So now I expect things to work again... though X11 mode may have issues,
and SDL overlay mode is dog slow.
parent 210cc022
......@@ -121,7 +121,7 @@ static void blinker_thread(void *data);
static __inline void *locked_screen_check(void);
static BOOL bitmap_draw_cursor(void);
static int update_from_vmem(int force);
static int bitmap_pputtext_locked(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg);
static int bitmap_vmem_puttext_locked(int sx, int sy, int ex, int ey, struct vmem_cell *fill);
static uint32_t color_value(uint32_t col);
/**************************************************************/
......@@ -255,13 +255,9 @@ error_return:
/* These functions get called from ciolib only */
/***********************************************/
static int bitmap_pputtext_locked(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg)
static int bitmap_vmem_puttext_locked(int sx, int sy, int ex, int ey, struct vmem_cell *fill)
{
int x,y;
unsigned char *out;
uint32_t *fgout;
uint32_t *bgout;
WORD sch;
struct vstat_vmem *vmem_ptr;
if(!bitmap_initialized)
......@@ -282,14 +278,9 @@ static int bitmap_pputtext_locked(int sx, int sy, int ex, int ey, void *fill, ui
pthread_mutex_lock(&vstatlock);
vmem_ptr = get_vmem(&vstat);
out=fill;
fgout = fg;
bgout = bg;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
sch=*(out++);
sch |= (*(out++))<<8;
set_vmem_cell(vmem_ptr, y*cio_textinfo.screenwidth+x, sch, fg ? *(fgout++) : 0x00ffffff, bg ? *(bgout++) : 0x00ffffff);
memcpy(&vmem_ptr->vmem[y*cio_textinfo.screenwidth+x], fill++, sizeof(*fill));
bitmap_draw_one_char_cursor(x+1, y+1);
}
}
......@@ -509,7 +500,6 @@ static int bitmap_draw_one_char(unsigned int xpos, unsigned int ypos)
int x;
int y;
int fontoffset;
int altfont;
unsigned char *this_font;
WORD sch;
struct vstat_vmem *vmem_ptr;
......@@ -766,33 +756,28 @@ static int update_from_vmem(int force)
/**********************/
int bitmap_puttext(int sx, int sy, int ex, int ey, void *fill)
{
int i, ret;
int x, y;
int ret = 1;
uint16_t *buf = fill;
uint32_t *fg;
uint32_t *bg;
fg = malloc((ex-sx+1)*(ey-sy+1)*sizeof(fg[0]));
if (fg == NULL)
return 0;
bg = malloc((ex-sx+1)*(ey-sy+1)*sizeof(bg[0]));
if (bg == NULL) {
free(fg);
return 0;
}
struct vstat_vmem *vmem_ptr;
pthread_mutex_lock(&blinker_lock);
for (i=0; i<(ex-sx+1)*(ey-sy+1); i++)
bitmap_attr2palette_locked(buf[i]>>8, &fg[i], &bg[i]);
ret = bitmap_pputtext_locked(sx,sy,ex,ey,fill,fg,bg);
pthread_mutex_lock(&vstatlock);
vmem_ptr = get_vmem(&vstat);
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
set_vmem_cell(vmem_ptr, y*cio_textinfo.screenwidth+x, *(buf++), 0x00ffffff, 0x00ffffff);
bitmap_draw_one_char_cursor(x+1, y+1);
}
}
release_vmem(vmem_ptr);
pthread_mutex_unlock(&vstatlock);
pthread_mutex_unlock(&blinker_lock);
free(fg);
free(bg);
return ret;
}
int bitmap_pputtext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg)
int bitmap_vmem_puttext(int sx, int sy, int ex, int ey, struct vmem_cell *fill)
{
int ret;
......@@ -800,18 +785,15 @@ int bitmap_pputtext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, ui
return(0);
pthread_mutex_lock(&blinker_lock);
ret = bitmap_pputtext_locked(sx, sy, ex, ey, fill, fg, bg);
ret = bitmap_vmem_puttext_locked(sx, sy, ex, ey, fill);
pthread_mutex_unlock(&blinker_lock);
return ret;
}
int bitmap_pgettext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg)
int bitmap_vmem_gettext(int sx, int sy, int ex, int ey, struct vmem_cell *fill)
{
int x,y;
unsigned char *out;
uint32_t *fgout;
uint32_t *bgout;
struct vstat_vmem *vmem_ptr;
if(!bitmap_initialized)
......@@ -832,18 +814,9 @@ int bitmap_pgettext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, ui
pthread_mutex_lock(&blinker_lock);
pthread_mutex_lock(&vstatlock);
vmem_ptr = get_vmem(&vstat);
out=fill;
fgout=fg;
bgout=bg;
for(y=sy-1;y<ey;y++) {
for(x=sx-1;x<ex;x++) {
*(out++)=vmem_ptr->vmem[y*cio_textinfo.screenwidth+x].ch;
*(out++)=vmem_ptr->vmem[y*cio_textinfo.screenwidth+x].legacy_attr;
if (fg)
*(fgout++) = vmem_ptr->vmem[y*cio_textinfo.screenwidth+x].fg;
if (bg)
*(bgout++) = vmem_ptr->vmem[y*cio_textinfo.screenwidth+x].bg;
}
for(x=sx-1;x<ex;x++)
memcpy(fill++, &vmem_ptr->vmem[y*cio_textinfo.screenwidth+x], sizeof(*fill));
}
release_vmem(vmem_ptr);
pthread_mutex_unlock(&vstatlock);
......@@ -918,21 +891,13 @@ int bitmap_setfont(int font, int force, int font_num)
int changemode=0;
int newmode=-1;
struct text_info ti;
char *old;
uint32_t *oldf;
uint32_t *oldb;
struct vmem_cell *old;
int ow,oh;
int row,col;
char *new;
uint32_t *newf;
uint32_t *newb;
struct vmem_cell *new;
int attr;
char *pold;
uint32_t *poldf;
uint32_t *poldb;
char *pnew;
uint32_t *pnewf;
uint32_t *pnewb;
struct vmem_cell *pold;
struct vmem_cell *pnew;
int result = CIOLIB_SETFONT_CHARHEIGHT_NOT_SUPPORTED;
if(!bitmap_initialized)
......@@ -1005,71 +970,55 @@ int bitmap_setfont(int font, int force, int font_num)
ow=ti.screenwidth;
oh=ti.screenheight;
old=malloc(ow*oh*2);
oldf=malloc(ow*oh*sizeof(oldf[0]));
oldb=malloc(ow*oh*sizeof(oldf[0]));
if(old && oldf && oldb) {
pgettext(1,1,ow,oh,old,oldf,oldb);
old=malloc(ow*oh*sizeof(*old));
if(old) {
bitmap_vmem_gettext(1,1,ow,oh,old);
textmode(newmode);
new=malloc(ti.screenwidth*ti.screenheight*2);
newf=malloc(ti.screenwidth*ti.screenheight*sizeof(newf[0]));
newb=malloc(ti.screenwidth*ti.screenheight*sizeof(newb[0]));
new=malloc(ti.screenwidth*ti.screenheight*sizeof(*new));
if(!new) {
free(old);
FREE_AND_NULL(oldf);
FREE_AND_NULL(oldb);
return CIOLIB_SETFONT_MALLOC_FAILURE;
}
pold=old;
poldf=oldf;
poldb=oldb;
pnew=new;
pnewf=newf;
pnewb=newb;
for(row=0; row<ti.screenheight; row++) {
for(col=0; col<ti.screenwidth; col++) {
if(row < oh) {
if(col < ow) {
*(new++)=*(old++);
*(new++)=*(old++);
*(newf++)=*(oldf++);
*(newb++)=*(oldb++);
memcpy(new, old, sizeof(*old));
new->font = font;
new++;
old++;
}
else {
*(new++)=space;
*(new++)=attr;
*(newf++) = ciolib_fg;
*(newb++) = ciolib_bg;
new->ch=space;
new->legacy_attr=attr;
new->font = font;
new->fg = ciolib_fg;
new->bg = ciolib_bg;
new++;
}
}
else {
*(new++)=space;
*(new++)=attr;
*(newf++) = ciolib_fg;
*(newb++) = ciolib_bg;
new->ch=space;
new->legacy_attr=attr;
new->font = font;
new->fg = ciolib_fg;
new->bg = ciolib_bg;
new++;
}
}
if(row < oh) {
for(;col<ow;col++) {
for(;col<ow;col++)
old++;
old++;
oldf++;
oldb++;
}
}
}
pputtext(1,1,ti.screenwidth,ti.screenheight,pnew,pnewf,pnewb);
bitmap_vmem_puttext(1,1,ti.screenwidth,ti.screenheight,pnew);
free(pnew);
free(pnewf);
free(pnewb);
free(pold);
free(poldf);
free(poldb);
}
else {
FREE_AND_NULL(old);
FREE_AND_NULL(oldf);
FREE_AND_NULL(oldb);
}
}
bitmap_loadfont_locked(NULL);
......
......@@ -23,8 +23,8 @@ extern pthread_mutex_t vstatlock;
#ifndef BITMAP_CIOLIB_DRIVER
/* Called from ciolib */
int bitmap_puttext(int sx, int sy, int ex, int ey, void *fill);
int bitmap_pputtext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg);
int bitmap_pgettext(int sx, int sy, int ex, int ey, void *fill, uint32_t *fg, uint32_t *bg);
int bitmap_vmem_puttext(int sx, int sy, int ex, int ey, struct vmem_cell *fill);
int bitmap_vmem_gettext(int sx, int sy, int ex, int ey, struct vmem_cell *fill);
void bitmap_gotoxy(int x, int y);
void bitmap_setcursortype(int type);
int bitmap_setfont(int font, int force, int font_no);
......
......@@ -105,9 +105,9 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_highvideo(void);
CIOLIBEXPORT void CIOLIBCALL ciolib_lowvideo(void);
CIOLIBEXPORT void CIOLIBCALL ciolib_normvideo(void);
CIOLIBEXPORT int CIOLIBCALL ciolib_puttext(int a,int b,int c,int d,void *e);
CIOLIBEXPORT int CIOLIBCALL ciolib_pputtext(int a,int b,int c,int d,void *e,uint32_t *f, uint32_t *g);
CIOLIBEXPORT int CIOLIBCALL ciolib_vmem_puttext(int a,int b,int c,int d,struct vmem_cell *e);
CIOLIBEXPORT int CIOLIBCALL ciolib_gettext(int a,int b,int c,int d,void *e);
CIOLIBEXPORT int CIOLIBCALL ciolib_pgettext(int a,int b,int c,int d,void *e, uint32_t *f, uint32_t *g);
CIOLIBEXPORT int CIOLIBCALL ciolib_vmem_gettext(int a,int b,int c,int d,struct vmem_cell *e);
CIOLIBEXPORT void CIOLIBCALL ciolib_textattr(int a);
CIOLIBEXPORT void CIOLIBCALL ciolib_delay(long a);
CIOLIBEXPORT int CIOLIBCALL ciolib_putch(int a);
......@@ -123,8 +123,6 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_get_window_info(int *width, int *height, int
CIOLIBEXPORT void CIOLIBCALL ciolib_setscaling(int new_value);
CIOLIBEXPORT int CIOLIBCALL ciolib_getscaling(void);
CIOLIBEXPORT int CIOLIBCALL ciolib_setpalette(uint32_t entry, uint16_t r, uint16_t g, uint16_t b);
CIOLIBEXPORT int CIOLIBCALL ciolib_cputch(uint32_t fg_palette, uint32_t bg_palette, int a);
CIOLIBEXPORT int CIOLIBCALL ciolib_ccputs(uint32_t fg_palette, uint32_t bg_palette, const char *str);
CIOLIBEXPORT int CIOLIBCALL ciolib_attr2palette(uint8_t attr, uint32_t *fg, uint32_t *bg);
CIOLIBEXPORT int CIOLIBCALL ciolib_setpixel(uint32_t x, uint32_t y, uint32_t colour);
CIOLIBEXPORT struct ciolib_pixels * CIOLIBCALL ciolib_getpixels(uint32_t sx, uint32_t sy, uint32_t ex, uint32_t ey);
......@@ -149,8 +147,8 @@ int try_sdl_init(int mode)
if(!sdl_initciolib(mode)) {
cio_api.mouse=1;
cio_api.puttext=bitmap_puttext;
cio_api.pputtext=bitmap_pputtext;
cio_api.pgettext=bitmap_pgettext;
cio_api.vmem_puttext=bitmap_vmem_puttext;
cio_api.vmem_gettext=bitmap_vmem_gettext;
cio_api.gotoxy=bitmap_gotoxy;
cio_api.setcursortype=bitmap_setcursortype;
cio_api.setfont=bitmap_setfont;
......@@ -212,8 +210,8 @@ int try_x_init(int mode)
cio_api.mode=CIOLIB_MODE_X;
cio_api.mouse=1;
cio_api.puttext=bitmap_puttext;
cio_api.pputtext=bitmap_pputtext;
cio_api.pgettext=bitmap_pgettext;
cio_api.vmem_puttext=bitmap_vmem_puttext;
cio_api.vmem_gettext=bitmap_vmem_gettext;
cio_api.gotoxy=bitmap_gotoxy;
cio_api.setcursortype=bitmap_setcursortype;
cio_api.setfont=bitmap_setfont;
......@@ -526,7 +524,7 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_movetext(int sx, int sy, int ex, int ey, int
{
int width;
int height;
unsigned char *buf;
void *buf;
uint32_t *fgb = NULL;
uint32_t *bgb = NULL;
......@@ -537,28 +535,19 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_movetext(int sx, int sy, int ex, int ey, int
width=ex-sx;
height=ey-sy;
buf=(unsigned char *)malloc((width+1)*(height+1)*2);
if(buf==NULL)
return(0);
if (cio_api.pgettext) {
fgb=(uint32_t *)malloc((width+1)*(height+1)*sizeof(fgb[0]));
if (fgb == NULL) {
free(buf);
if (cio_api.vmem_gettext) {
buf=malloc((width+1)*(height+1)*sizeof(struct vmem_cell));
if (buf == NULL)
return 0;
}
bgb=(uint32_t *)malloc((width+1)*(height+1)*sizeof(bgb[0]));
if (bgb == NULL) {
free(fgb);
free(buf);
return 0;
}
if(!ciolib_pgettext(sx,sy,ex,ey,buf,fgb,bgb))
if(!ciolib_vmem_gettext(sx,sy,ex,ey,buf))
goto fail;
if(!ciolib_pputtext(dx,dy,dx+width,dy+height,buf,fgb,bgb))
if(!ciolib_vmem_puttext(dx,dy,dx+width,dy+height,buf))
goto fail;
}
else {
buf=malloc((width+1)*(height+1)*2);
if (buf == NULL)
return 0;
if(!ciolib_gettext(sx,sy,ex,ey,buf))
goto fail;
if(!ciolib_puttext(dx,dy,dx+width,dy+height,buf))
......@@ -867,9 +856,7 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_window(int sx, int sy, int ex, int ey)
/* Optional */
CIOLIBEXPORT void CIOLIBCALL ciolib_clreol(void)
{
unsigned char *buf;
uint32_t *fgbuf = NULL;
uint32_t *bgbuf = NULL;
struct vmem_cell *buf;
int i;
int width,height;
......@@ -882,49 +869,29 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_clreol(void)
width=cio_textinfo.winright-cio_textinfo.winleft+1-cio_textinfo.curx+1;
height=1;
buf=(unsigned char *)malloc(width*height*2);
buf=malloc(width*height*sizeof(*buf));
if (!buf)
return;
if (cio_api.pputtext) {
fgbuf = malloc(width*height*sizeof(fgbuf[0]));
if (!fgbuf) {
free(buf);
return;
}
bgbuf = malloc(width*height*sizeof(bgbuf[0]));
if (!bgbuf) {
free(fgbuf);
free(buf);
return;
}
for (i = 0; i < width*height; i++) {
fgbuf[i] = ciolib_fg;
bgbuf[i] = ciolib_bg;
}
for(i=0;i<width*height;i++) {
buf[i].ch = ' ';
buf[i].legacy_attr = cio_textinfo.attribute;
buf[i].fg = ciolib_fg;
buf[i].bg = ciolib_bg;
buf[i].font = ciolib_attrfont(cio_textinfo.attribute);
}
for(i=0;i<width*height*2;) {
buf[i++]=' ';
buf[i++]=cio_textinfo.attribute;
}
ciolib_pputtext(
ciolib_vmem_puttext(
cio_textinfo.curx+cio_textinfo.winleft-1,
cio_textinfo.cury+cio_textinfo.wintop-1,
cio_textinfo.winright,
cio_textinfo.cury+cio_textinfo.wintop-1,
buf, fgbuf, bgbuf);
if (fgbuf)
free(fgbuf);
if (bgbuf)
free(bgbuf);
buf);
free(buf);
}
/* Optional */
CIOLIBEXPORT void CIOLIBCALL ciolib_clrscr(void)
{
unsigned char *buf;
uint32_t *fgbuf = NULL;
uint32_t *bgbuf = NULL;
struct vmem_cell *buf;
int i;
int width,height;
int old_ptcm=puttext_can_move;
......@@ -937,39 +904,21 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_clrscr(void)
width=cio_textinfo.winright-cio_textinfo.winleft+1;
height=cio_textinfo.winbottom-cio_textinfo.wintop+1;
buf=(unsigned char *)malloc(width*height*2);
buf=malloc(width*height*sizeof(*buf));
if(!buf)
return;
if (cio_api.pputtext) {
fgbuf = malloc(width*height*sizeof(fgbuf[0]));
if (!fgbuf) {
free(buf);
return;
}
bgbuf = malloc(width*height*sizeof(bgbuf[0]));
if (!bgbuf) {
free(fgbuf);
free(buf);
return;
}
for (i = 0; i < width*height; i++) {
fgbuf[i] = ciolib_fg;
bgbuf[i] = ciolib_bg;
}
}
for(i=0;i<width*height*2;) {
buf[i++]=' ';
buf[i++]=cio_textinfo.attribute;
for(i=0;i<width*height;i++) {
buf[i].ch = ' ';
buf[i].legacy_attr = cio_textinfo.attribute;
buf[i].fg = ciolib_fg;
buf[i].bg = ciolib_bg;
buf[i].font = ciolib_attrfont(cio_textinfo.attribute);
}
puttext_can_move=1;
ciolib_pputtext(cio_textinfo.winleft,cio_textinfo.wintop,cio_textinfo.winright,cio_textinfo.winbottom,buf,fgbuf,bgbuf);
ciolib_vmem_puttext(cio_textinfo.winleft,cio_textinfo.wintop,cio_textinfo.winright,cio_textinfo.winbottom,buf);
ciolib_gotoxy(1,1);
puttext_can_move=old_ptcm;
if (fgbuf)
free(fgbuf);
if (bgbuf)
free(bgbuf);
free(buf);
}
......@@ -1367,10 +1316,20 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_gettext(int a,int b,int c,int d,void *e)
int i;
int font;
int ret;
struct vmem_cell *buf;
CIOLIB_INIT();
if (cio_api.gettext == NULL)
ret = cio_api.pgettext(a,b,c,d,e,NULL,NULL);
if (cio_api.gettext == NULL) {
buf = malloc((c-a+1)*(d-b+1)*sizeof(*buf));
if (buf == NULL)
return 1;
ch = e;
ret = cio_api.vmem_gettext(a,b,c,d,buf);
for (i=0; i<(c-a+1)*(d-b+1); i++) {
*(ch++)=buf[i].ch;
*(ch++)=buf[i].legacy_attr;
}
}
else
ret = cio_api.gettext(a,b,c,d,e);
if(ciolib_xlat) {
......@@ -1399,23 +1358,47 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_gettext(int a,int b,int c,int d,void *e)
}
/* Optional */
CIOLIBEXPORT int CIOLIBCALL ciolib_pgettext(int a,int b,int c,int d,void *e,uint32_t *f, uint32_t *g)
CIOLIBEXPORT int CIOLIBCALL ciolib_vmem_gettext(int a,int b,int c,int d,struct vmem_cell *e)
{
int ret;
uint16_t *buf;
int i;
CIOLIB_INIT();
if (cio_api.pgettext == NULL)
return ciolib_gettext(a, b, c, d, e);
return cio_api.pgettext(a,b,c,d,e,f,g);
if (cio_api.vmem_gettext == NULL) {
buf = malloc((c-a+1)*(d-b+1)*sizeof(*buf));
if (buf == NULL)
return 1;
ret = ciolib_gettext(a, b, c, d, e);
for (i=0; i<(c-a+1)*(d-b+1); i++) {
e[i].ch = buf[i] & 0xff;
e[i].legacy_attr = buf[i] >> 8;
}
free(buf);
return ret;
}
return cio_api.vmem_gettext(a,b,c,d,e);
}
/* Optional */
CIOLIBEXPORT int CIOLIBCALL ciolib_pputtext(int a,int b,int c,int d,void *e,uint32_t *f, uint32_t *g)
CIOLIBEXPORT int CIOLIBCALL ciolib_vmem_puttext(int a,int b,int c,int d,struct vmem_cell *e)
{
int i;
int ret;
uint16_t *buf;
CIOLIB_INIT();
if (cio_api.pputtext == NULL)
return ciolib_puttext(a, b, c, d, e);
return cio_api.pputtext(a,b,c,d,e,f,g);
if (cio_api.vmem_puttext == NULL) {
buf = malloc((c-a+1)*(d-b+1)*sizeof(*buf));
if (buf == NULL)
return 0;
for (i=0; i<(c-a+1)*(d-b+1); i++)
buf[i] = (e[i].legacy_attr << 8) | (e[i].ch);
ret = ciolib_puttext(a, b, c, d, buf);
free(buf);
return ret;
}
return cio_api.vmem_puttext(a,b,c,d,e);
}
/* Optional */
......@@ -1445,26 +1428,25 @@ CIOLIBEXPORT void CIOLIBCALL ciolib_delay(long a)
}
/* Optional */
CIOLIBEXPORT int CIOLIBCALL ciolib_cputch(uint32_t fg, uint32_t bg, int a)
CIOLIBEXPORT int CIOLIBCALL ciolib_putch(int a)
{
unsigned char a1=a;
unsigned char buf[2];
uint32_t fgbuf[1];
uint32_t bgbuf[1];
struct vmem_cell buf;
int i;
int old_puttext_can_move=puttext_can_move;
CIOLIB_INIT();
if(cio_api.cputch)
return(cio_api.cputch(fg, bg, a1));
if(cio_api.putch)
return(cio_api.putch(a1));
puttext_can_move=1;
buf[0]=a1;
buf[1]=cio_textinfo.attribute;
fgbuf[0] = fg;
bgbuf[0] = bg;
buf.ch=a1;
buf.legacy_attr=cio_textinfo.attribute;
buf.fg = ciolib_fg;
buf.bg = ciolib_bg;
buf.font = ciolib_attrfont(cio_textinfo.attribute);
switch(a1) {
case '\r':
......@@ -1479,12 +1461,12 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_cputch(uint32_t fg, uint32_t bg, int a)
case '\b':
if(cio_textinfo.curx>1) {
ciolib_gotoxy(cio_textinfo.curx-1,cio_textinfo.cury);
buf[0]=' ';
ciolib_pputtext(cio_textinfo.curx+cio_textinfo.winleft-1