included vncterm

pull/1/head
dscho 22 years ago
parent 28a84b63fe
commit 23f45bc764

@ -1,5 +1,5 @@
SUBDIRS=. examples contrib
DIST_SUBDIRS=examples contrib
SUBDIRS=. examples contrib vncterm
DIST_SUBDIRS=examples contrib vncterm
bin_SCRIPTS = libvncserver-config

@ -87,6 +87,9 @@ AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_LIB(socket,socket)
AC_CHECK_FUNCS([ftime gethostbyname gethostname gettimeofday inet_ntoa memmove memset mkfifo select socket strchr strcspn strdup strerror strstr])
# Check if /dev/vcsa1 exists, if so, define LINUX
AM_CONDITIONAL(LINUX, test -c /dev/vcsa1)
# Check for rpm SOURCES path
echo -n "checking for rpm sources path... "
RPMSOURCEDIR="NOT-FOUND"
@ -104,6 +107,7 @@ LDADD="-L.. -lvncserver"
AC_CONFIG_FILES([Makefile
contrib/Makefile
examples/Makefile
vncterm/Makefile
libvncserver.spec
libvncserver-config])
AC_OUTPUT

@ -4,7 +4,7 @@ example
fontsel
pnmshow
pnmshow24
sratest
regiontest
storepasswd
vncev
Makefile.in

@ -0,0 +1,7 @@
LinuxVNC
VNCommand
example
.deps
Makefile
Makefile.in

@ -0,0 +1,15 @@
included in LibVNCServer package, autoconf'ed it
SetXCutText implemented
fix for cargs
attributes work.
cursor in LinuxVNC is shown.
paste works
selection works (no cursor trails)
LinuxVNC gets it's dimensions via ioctl TIOCGWINSZ
First working key injection in LinuxVNC!
Added Mouse marking
added screenBuffer (so you have ASCII screen also)
fixed CopyRect for scrolling (need to propagate to libvncserver)
made VNCommand work (no prompt for bash, but else seems ok)
added flag for VNCommand to send input only after a newline
(good for interactive bash)

@ -0,0 +1,172 @@
#include "VNConsole.h"
#include "vga.h"
#include <fcntl.h>
#include <sys/ioctl.h>
static int tty=2;
static int tty_inject_device;
void do_key(Bool down,KeySym keySym,rfbClientPtr cl)
{
static char isControl=0;
if(down) {
/* if(keySym==XK_Escape)
rfbCloseClient(cl);
else */ if(keySym==XK_Control_L || keySym==XK_Control_R)
isControl++;
else if(tty_inject_device>=0) {
if(keySym==XK_Escape)
keySym=27;
if(isControl) {
if(keySym>='a' && keySym<='z')
keySym-='a'-1;
else if(keySym>='A' && keySym<='Z')
keySym-='A'-1;
else
keySym=0xffff;
}
if(keySym==XK_Tab)
keySym='\t';
else if(keySym==XK_Return)
keySym='\r';
else if(keySym==XK_BackSpace)
keySym=8;
else if(keySym==XK_Home || keySym==XK_KP_Home)
keySym=1;
else if(keySym==XK_End || keySym==XK_KP_End)
keySym=5;
else if(keySym==XK_Up || keySym==XK_KP_Up)
keySym=16;
else if(keySym==XK_Down || keySym==XK_KP_Down)
keySym=14;
else if(keySym==XK_Right || keySym==XK_KP_Right)
keySym=6;
else if(keySym==XK_Left || keySym==XK_KP_Left)
keySym=2;
if(keySym<0x100) {
int ret;
//fprintf(stderr,"do_key: %c (0x%lx)\n",(char)keySym,keySym);
ret=ioctl(tty_inject_device,TIOCSTI,&keySym);
if(ret<0) {
static char device[64];
close(tty_inject_device);
sprintf(device,"/dev/tty%d",tty);
tty_inject_device=open(device,O_WRONLY);
ret=ioctl(tty_inject_device,TIOCSTI,&keySym);
if(ret<0)
fprintf(stderr,"Couldn't reopen device %s!\n",device);
}
}
}
} else if(keySym==XK_Control_L || keySym==XK_Control_R)
isControl--;
}
int main(int argc,char **argv)
{
int width=80,height=25;
char *buffer;
vncConsolePtr console;
char tty_device[64],title[128];
int i;
FILE* tty_file;
struct winsize dimensions;
if(argc>1) {
if((tty=atoi(argv[1]))<1) {
fprintf(stderr,"Usage: %s [tty_number [vnc args]]\n",argv[0]);
exit(1);
} else {
argv++;
argc--;
}
}
/* getopt goes here! */
sprintf(tty_device,"/dev/tty%d",tty);
if((tty_inject_device=open(tty_device,O_WRONLY))<0) {
fprintf(stderr,"Couldn't open tty device %s!\n",tty_device);
exit(1);
}
fprintf(stderr,"Using device %s.\n",tty_device);
if(ioctl(tty_inject_device,TIOCGWINSZ,&dimensions)>=0) {
width=dimensions.ws_col;
height=dimensions.ws_row;
}
sprintf(title,"LinuxVNC: /dev/tty%d",tty);
/* console init */
console=vcGetConsole(&argc,argv,width,height,&vgaFont,TRUE);
console->rfbScreen->desktopName=title;
console->rfbScreen->kbdAddEvent=do_key;
console->selectTimeOut=100000;
console->wrapBottomToTop=TRUE;
#ifdef USE_OLD_VCS
buffer=malloc(width*height);
console->cursorActive=FALSE;
#else
buffer=malloc(width*height*2+4);
console->cursorActive=TRUE;
#endif
/* memcpy(buffer,console->screenBuffer,width*height); */
#ifdef USE_OLD_VCS
sprintf(tty_device,"/dev/vcs%d",tty);
#else
sprintf(tty_device,"/dev/vcsa%d",tty);
#endif
while(1) {
if(!console->currentlyMarking) {
tty_file=fopen(tty_device,"rb");
if(!tty_file) {
fprintf(stderr,"cannot open device \"%s\"\n",
tty_device);
exit(1);
}
#ifdef USE_OLD_VCS
fread(buffer,width,height,tty_file);
#else
fread(buffer,width*height*2+4,1,tty_file);
vcHideCursor(console);
#endif
fclose(tty_file);
for(i=0;i<console->width*console->height;i++) {
if
#ifdef USE_OLD_VCS
(buffer[i]!=console->screenBuffer[i])
#else
(buffer[4+2*i]!=console->screenBuffer[i] ||
buffer[5+2*i]!=console->attributeBuffer[i])
#endif
{
console->x=(i%console->width);
console->y=(i/console->width);
/*
fprintf(stderr,"changes: %d,%d (%d!=%d || %d!=%d)\n",
console->x,console->y,
buffer[4+2*i],console->screenBuffer[i],
buffer[5+2*i],console->attributeBuffer[i]);
*/
#ifdef USE_OLD_VCS
vcPutChar(console,buffer[i]);
#else
vcPutCharColour(console,buffer[4+i*2],buffer[5+i*2]&0x7,buffer[5+i*2]>>4);
#endif
}
}
console->x=buffer[2];
console->y=buffer[3];
}
vcProcessEvents(console);
}
return(0);
}

@ -0,0 +1,16 @@
CONSOLE_SRCS=VNConsole.c
noinst_HEADERS=VNConsole.h
LDADD=-L.. -lvncserver
INCLUDES=-I. -I../include
if LINUX
bin_PROGRAMS=LinuxVNC
LinuxVNC_SOURCES=LinuxVNC.c $(CONSOLE_SRCS)
endif
noinst_PROGRAMS=VNCommand example
VNCommand_SOURCES=VNCommand.c $(CONSOLE_SRCS)
example_SOURCES=example.c $(CONSOLE_SRCS)

@ -0,0 +1,25 @@
In this stage (beta), there are two programs functional:
LinuxVNC <tty number>
monitor a virtual console (text mode) of Linux. You need
root privileges, or at least be in the "tty" group, because
it reads /dev/vcsN and writes /dev/ttyN.
It follows the same idea as WinVNC, x11vnc or OSXvnc, i.e. it
takes an existing desktop and exports it via RFB (VNC), just that
LinuxVNC exports text.
VNCommand <command> <args>
executes <command> redirecting stdin from a vncviewer and stdout &
stderr to the vnc clients. This might be renamed to vncTerm if
there are some term capabilities added (up to now, bash doesn't look
nice). Colours and other ANSI sequences need to be added.
My original plan was to create a program named vncTerm. It was meant to
overcome incompatibilities between different TERMs, but I found "screen" to
be just such a program. Maybe once some time in the future I'll make a
patch for screen to use VNConsole to export it's contents via RFB...
These two programs are a simple application of LibVNCServer with a small
console layer in between (VNConsole). You can use them under the terms
(not vncTerms ;-) of the GPL. They where written by Johannes E. Schindelin.

@ -0,0 +1,21 @@
VNConsole:
LinuxVNC:
VNCommand:
make Control or Alt sequences work.
Find out how to satisfy isatty(). => /dev/ptyN
Fix check if child is alive.
Add command line option for real interactive mode.
done:
.treat colours correctly (use /dev/vcsaN's attributes).
.introduce per cell colours (for attributes)
.fix cursor fuckup when selecting.
.default to paste for right mouse button.
.have an idea how to insert keys
.convert VNCommand to an interactive shell (vncTerm)
.bidirectional pipes (spawn a shell ...)
.mark with mouse (copy text)
.when scrolling, cursor must be hidden!
modifiedRegion which are copied with CopyRect have to be modified also.

@ -0,0 +1,116 @@
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/time.h>
#include <unistd.h>
#include <errno.h>
#include "VNConsole.h"
#include "vga.h"
int main(int argc, char **argv)
{
Bool interactive=FALSE,sendOnlyWholeLines=TRUE;
int serverArgc,programArg0;
for(serverArgc=1;serverArgc<argc
&& argv[serverArgc][0]=='-' && argv[serverArgc][1]!='-';serverArgc++)
if(!strcmp(argv[serverArgc],"-interactive")) {
interactive=TRUE;
sendOnlyWholeLines=FALSE;
rfbPurgeArguments(&argc,&serverArgc,1,argv);
}
programArg0=serverArgc;
if(programArg0<argc && argv[programArg0][0]=='-' && argv[programArg0][1]=='-')
programArg0++;
argv[argc]=0;
if(programArg0<argc) {
int in[2],out[2],err[2],pid;
if(pipe(in)<0 || pipe(out)<0 || pipe(err)<0) {
fprintf(stderr,"Couldn't make pipes!");
return(1);
}
pid=fork();
if(!pid) {
dup2(in[0],0);
dup2(out[1],1);
dup2(err[1],2);
//setbuf(stdin,NULL);
execvp(argv[programArg0],argv+programArg0);
}
{
char buffer[1024];
fd_set fs,fs1/*,ifs,ifs1*/;
struct timeval tv,tv1;
int i,c=1,num_fds,max_fd=out[0];
FILE *input_pipe;
vncConsolePtr console=vcGetConsole(&serverArgc,argv,80,25,&vgaFont,FALSE);
if(interactive)
console->doEcho = FALSE;
if(max_fd<err[0])
max_fd=err[0];
FD_ZERO(&fs);
FD_SET(out[0],&fs);
FD_SET(err[0],&fs);
//FD_SET(0,&fs);
tv.tv_sec=0; tv.tv_usec=5000;
input_pipe=fdopen(in[1],"w");
setbuf(input_pipe,NULL);
while(c || getpgid(pid)>=0) {
/* event loop */
vcProcessEvents(console);
/* get input */
if(console->inputCount) {
if(sendOnlyWholeLines) {
for(i=0;i<console->inputCount;i++)
if(console->inputBuffer[i]=='\n') {
i++;
fwrite(console->inputBuffer,i,1,input_pipe);
fflush(input_pipe);
/* fwrite(console->inputBuffer,i,1,stderr); */
if(console->inputCount>i)
memmove(console->inputBuffer,console->inputBuffer+i,console->inputCount-i);
console->inputCount-=i;
i=0;
}
} else {
fwrite(console->inputBuffer,console->inputCount,1,input_pipe);
fflush(input_pipe);
/* fwrite(console->inputBuffer,console->inputCount,1,stderr); */
console->inputCount=0;
}
}
/* process output */
fs1=fs; tv1=tv;
num_fds=select(max_fd+1,&fs1,NULL,NULL,&tv1);
if(num_fds>0) {
/*
if(FD_ISSET(0,&fs1)) {
ch=getchar();
fputc(ch,f);
}
*/
if(FD_ISSET(out[0],&fs1)) {
c=read(out[0],buffer,1024);
for(i=0;i<c;i++)
vcPutChar(console,buffer[i]);
}
if(FD_ISSET(err[0],&fs1)) {
c=read(err[0],buffer,1024);
for(i=0;i<c;i++)
vcPutChar(console,buffer[i]);
}
} else
c=0;
}
}
}
fprintf(stderr,"exit\n");
return(0);
}

@ -0,0 +1,499 @@
#include <stdarg.h>
#include "VNConsole.h"
#define DEBUG(x)
unsigned char colourMap16[16*3]={
/* 0 black #000000 */ 0x00,0x00,0x00,
/* 1 maroon #800000 */ 0x80,0x00,0x00,
/* 2 green #008000 */ 0x00,0x80,0x00,
/* 3 khaki #808000 */ 0x80,0x80,0x00,
/* 4 navy #000080 */ 0x00,0x00,0x80,
/* 5 purple #800080 */ 0x80,0x00,0x80,
/* 6 aqua-green #008080 */ 0x00,0x80,0x80,
/* 7 light grey #c0c0c0 */ 0xc0,0xc0,0xc0,
/* 8 dark grey #808080 */ 0x80,0x80,0x80,
/* 9 red #ff0000 */ 0xff,0x00,0x00,
/* a light green #00ff00 */ 0x00,0xff,0x00,
/* b yellow #ffff00 */ 0xff,0xff,0x00,
/* c blue #0000ff */ 0x00,0x00,0xff,
/* d pink #ff00ff */ 0xff,0x00,0xff,
/* e light blue #00ffff */ 0x00,0xff,0xff,
/* f white #ffffff */ 0xff,0xff,0xff
};
void MakeColourMap16(vncConsolePtr c)
{
rfbColourMap* colourMap=&(c->rfbScreen->colourMap);
if(colourMap->count)
free(colourMap->data.bytes);
colourMap->data.bytes=malloc(16*3);
memcpy(colourMap->data.bytes,colourMap16,16*3);
colourMap->count=16;
colourMap->is16=FALSE;
c->rfbScreen->rfbServerFormat.trueColour=FALSE;
}
void vcDrawOrHideCursor(vncConsolePtr c)
{
int i,j,w=c->rfbScreen->paddedWidthInBytes;
char *b=c->rfbScreen->frameBuffer+c->y*c->cHeight*w+c->x*c->cWidth;
for(j=c->cy1;j<c->cy2;j++)
for(i=c->cx1;i<c->cx2;i++)
b[j*w+i]^=0x0f;
rfbMarkRectAsModified(c->rfbScreen,
c->x*c->cWidth+c->cx1,c->y*c->cHeight+c->cy1,
c->x*c->cWidth+c->cx2,c->y*c->cHeight+c->cy2);
c->cursorIsDrawn=c->cursorIsDrawn?FALSE:TRUE;
}
void vcDrawCursor(vncConsolePtr c)
{
rfbDrawCursor(c->rfbScreen);
if(c->cursorActive && !c->cursorIsDrawn && c->y<c->height && c->x<c->width) {
/* fprintf(stderr,"DrawCursor: %d,%d\n",c->x,c->y); */
vcDrawOrHideCursor(c);
}
}
void vcHideCursor(vncConsolePtr c)
{
rfbUndrawCursor(c->rfbScreen);
if(c->currentlyMarking)
vcUnmark(c);
if(c->cursorIsDrawn) {
/* fprintf(stderr,"HideCursor: %d,%d\n",c->x,c->y); */
vcDrawOrHideCursor(c);
}
}
void vcMakeSureCursorIsDrawn(rfbClientPtr cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
if(!c->dontDrawCursor)
vcDrawCursor(c);
}
vncConsolePtr vcGetConsole(int *argc,char **argv,
int width,int height,rfbFontDataPtr font
#ifdef USE_ATTRIBUTE_BUFFER
,Bool withAttributes
#endif
)
{
vncConsolePtr c=(vncConsolePtr)malloc(sizeof(vncConsole));
c->font=font;
c->width=width;
c->height=height;
c->screenBuffer=(char*)malloc(width*height);
memset(c->screenBuffer,' ',width*height);
#ifdef USE_ATTRIBUTE_BUFFER
if(withAttributes) {
c->attributeBuffer=(char*)malloc(width*height);
memset(c->attributeBuffer,0x07,width*height);
} else
c->attributeBuffer=NULL;
#endif
c->x=0;
c->y=0;
c->wrapBottomToTop=FALSE;
c->cursorActive=TRUE;
c->cursorIsDrawn=FALSE;
c->dontDrawCursor=FALSE;
c->inputBuffer=(char*)malloc(1024);
c->inputSize=1024;
c->inputCount=0;
c->selection=0;
c->selectTimeOut=40000; /* 40 ms */
c->doEcho=TRUE;
c->wasRightButtonDown=FALSE;
c->currentlyMarking=FALSE;
rfbWholeFontBBox(font,&c->xhot,&c->cHeight,&c->cWidth,&c->yhot);
c->cWidth-=c->xhot;
c->cHeight=-c->cHeight-c->yhot;
/* text cursor */
c->cx1=c->cWidth/8;
c->cx2=c->cWidth*7/8;
c->cy2=c->cHeight-1-c->yhot+c->cHeight/16;
if(c->cy2>=c->cHeight)
c->cy2=c->cHeight-1;
c->cy1=c->cy2-c->cHeight/8;
if(c->cy1<0)
c->cy2=0;
c->rfbScreen=
rfbGetScreen(argc,argv,c->cWidth*c->width,c->cHeight*c->height,8,1,1);
c->rfbScreen->screenData=(void*)c;
c->rfbScreen->displayHook=vcMakeSureCursorIsDrawn;
c->rfbScreen->frameBuffer=
(char*)malloc(c->rfbScreen->width*c->rfbScreen->height);
memset(c->rfbScreen->frameBuffer,c->backColour,
c->rfbScreen->width*c->rfbScreen->height);
c->rfbScreen->kbdAddEvent=vcKbdAddEventProc;
c->rfbScreen->ptrAddEvent=vcPtrAddEventProc;
c->rfbScreen->setXCutText=vcSetXCutTextProc;
MakeColourMap16(c);
c->foreColour=0x7;
c->backColour=0;
rfbInitServer(c->rfbScreen);
return(c);
}
#include "rfbregion.h"
/* before using this function, hide the cursor */
void vcScroll(vncConsolePtr c,int lineCount)
{
int y1,y2;
rfbScreenInfoPtr s=c->rfbScreen;
if(lineCount==0)
return;
/* fprintf(stderr,"begin scroll\n"); */
vcHideCursor(c);
c->dontDrawCursor=TRUE;
if(lineCount>=c->height || lineCount<=-c->height) {
y1=0; y2=s->height;
} else if(lineCount>0) {
y1=s->height-lineCount*c->cHeight; y2=s->height;
rfbDoCopyRect(s,0,0,s->width,y1,0,-lineCount*c->cHeight);
memmove(c->screenBuffer,
c->screenBuffer+(c->height-lineCount)*c->width,
(c->height-lineCount)*c->width);
#ifdef USE_ATTRIBUTE_BUFFER
memmove(c->attributeBuffer,
c->attributeBuffer+(c->height-lineCount)*c->width,
(c->height-lineCount)*c->width);
#endif
} else {
y1=0; y2=-lineCount*c->cHeight;
rfbDoCopyRect(s,0,y2,s->width,s->height,0,-lineCount*c->cHeight);
memmove(c->screenBuffer-lineCount*c->width,
c->screenBuffer,
(c->height+lineCount)*c->width);
#ifdef USE_ATTRIBUTE_BUFFER
memmove(c->attributeBuffer-lineCount*c->width,
c->attributeBuffer,
(c->height+lineCount)*c->width);
#endif
}
c->dontDrawCursor=FALSE;
memset(s->frameBuffer+y1*s->width,c->backColour,(y2-y1)*s->width);
rfbMarkRectAsModified(s,0,y1-c->cHeight,s->width,y2);
memset(c->screenBuffer+y1/c->cHeight*c->width,' ',
(y2-y1)/c->cHeight*c->width);
#ifdef USE_ATTRIBUTE_BUFFER
memset(c->attributeBuffer+y1/c->cHeight*c->width,0x07,
(y2-y1)/c->cHeight*c->width);
#endif
/* fprintf(stderr,"end scroll\n"); */
}
void vcCheckCoordinates(vncConsolePtr c)
{
if(c->x>=c->width) {
c->x=0;
c->y++;
}
if(c->y>=c->height) {
if(c->wrapBottomToTop)
c->y=0;
else {
vcScroll(c,c->y+1-c->height);
c->y=c->height-1;
}
}
}
void vcPutChar(vncConsolePtr c,unsigned char ch)
{
#ifdef USE_ATTRIBUTE_BUFFER
if(c->attributeBuffer) {
unsigned char colour=c->attributeBuffer[c->x+c->y*c->width];
vcPutCharColour(c,ch,colour&0x7,colour>>4);
} else
#endif
vcPutCharColour(c,ch,c->foreColour,c->backColour);
}
void vcPutCharColour(vncConsolePtr c,unsigned char ch,unsigned char foreColour,unsigned char backColour)
{
rfbScreenInfoPtr s=c->rfbScreen;
int j,x,y;
vcHideCursor(c);
if(ch<' ') {
switch(ch) {
case 7:
case 13:
break;
case 8: /* BackSpace */
if(c->x>0) {
c->x--;
vcPutChar(c,' ');
c->x--;
}
break;
case 10: /* return */
c->x=0;
c->y++;
vcCheckCoordinates(c);
break;
case 9: /* tabulator */
do {
vcPutChar(c,' ');
} while(c->x%8);
break;
default:
fprintf(stderr,"putchar of unknown character: %c(%d).\n",ch,ch);
vcPutChar(c,' ');
}
} else {
#ifdef USE_ATTRIBUTE_BUFFER
if(c->attributeBuffer)
c->attributeBuffer[c->x+c->y*c->width]=foreColour|(backColour<<4);
#endif
x=c->x*c->cWidth;
y=c->y*c->cHeight;
for(j=y+c->cHeight-1;j>=y;j--)
memset(s->frameBuffer+j*s->width+x,backColour,c->cWidth);
rfbDrawChar(s,c->font,
x-c->xhot+(c->cWidth-rfbWidthOfChar(c->font,ch))/2,
y+c->cHeight-c->yhot-1,
ch,foreColour);
c->screenBuffer[c->y*c->width+c->x]=ch;
c->x++;
rfbMarkRectAsModified(s,x,y-c->cHeight+1,x+c->cWidth,y+c->cHeight+1);
vcCheckCoordinates(c);
}
}
void vcPrint(vncConsolePtr c,unsigned char* str)
{
while(*str) {
vcPutChar(c,*str);
str++;
}
}
void vcPrintColour(vncConsolePtr c,unsigned char* str,unsigned char foreColour,unsigned char backColour)
{
while(*str) {
vcPutCharColour(c,*str,foreColour,backColour);
str++;
}
}
void vcPrintF(vncConsolePtr c,char* format,...)
{
va_list args;
char buf[4096];
va_start(args, format);
vsprintf(buf, format, args);
vcPrint(c,buf);
va_end(args);
}
void vcPrintFColour(vncConsolePtr c,unsigned char foreColour,unsigned char backColour,char* format,...)
{
va_list args;
char buf[4096];
va_start(args, format);
vsprintf(buf, format, args);
vcPrintColour(c,buf,foreColour,backColour);
va_end(args);
}
char vcGetCh(vncConsolePtr c)
{
if(c->inputCount>0) {
char ch;
ch=c->inputBuffer[0];
c->inputCount--;
if(c->inputCount>0)
memmove(c->inputBuffer,c->inputBuffer+1,c->inputCount);
return(ch);
} else
return(0);
}
char vcGetChar(vncConsolePtr c)
{
while(c->inputCount==0)
vcProcessEvents(c);
return(vcGetCh(c));
}
char *vcGetString(vncConsolePtr c,char *buffer,int bufferSize)
{
char *bufferBackup=c->inputBuffer;
int i,count=bufferSize-1;
if(count>c->inputCount)
count=c->inputCount;
for(i=1;i<count && bufferBackup[i-1]!='\n';i++);
if(i<count || i==bufferSize-1) {
memcpy(buffer,bufferBackup,i);
buffer[i+1]=0;
c->inputCount-=i;
memmove(bufferBackup,bufferBackup+i+2,c->inputCount);
return(buffer);
}
memcpy(buffer,bufferBackup,c->inputCount);
count=c->inputSize;
c->inputSize=bufferSize;
c->inputBuffer=buffer;
while(c->inputCount<bufferSize-1 && buffer[c->inputCount-1]!='\n')
vcProcessEvents(c);
buffer[c->inputCount]=0;
c->inputBuffer=bufferBackup;
c->inputSize=count;
c->inputCount=0;
return(buffer);
}
void vcKbdAddEventProc(Bool down,KeySym keySym,rfbClientPtr cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
if(down) {
if(c->inputCount<c->inputSize) {
if(keySym<0 || keySym>0xff) {
if(keySym==XK_Return) keySym='\n';
else if(keySym==XK_BackSpace) keySym=8;
else if(keySym==XK_Tab) keySym=9;
else keySym=0;
}
if(keySym>0) {
if(keySym==8) {
if(c->inputCount>0)
c->inputCount--;
} else
c->inputBuffer[c->inputCount++]=(char)keySym;
if(c->doEcho)
vcPutChar(c,(unsigned char)keySym);
}
}
}
}
void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
rfbUndrawCursor(c->rfbScreen);
if(c->wasRightButtonDown) {
if((buttonMask&4)==0) {
if(c->selection) {
char* s;
for(s=c->selection;*s;s++) {
c->rfbScreen->kbdAddEvent(1,*s,cl);
c->rfbScreen->kbdAddEvent(0,*s,cl);
}
}
c->wasRightButtonDown=0;
}
} else if(buttonMask&4)
c->wasRightButtonDown=1;
if(buttonMask&1) {
int cx=x/c->cWidth,cy=y/c->cHeight,pos;
if(cx<0) cx=0; else if(cx>=c->width) cx=c->width-1;
if(cy<0) cy=0; else if(cy>=c->height) cy=c->height-1;
pos=cy*c->width+cx;
// mark
if(!c->currentlyMarking) {
c->currentlyMarking=TRUE;
c->markStart=pos;
c->markEnd=pos;
vcToggleMarkCell(c,pos);
} else {
DEBUG(fprintf(stderr,"markStart: %d, markEnd: %d, pos: %d\n",
c->markStart,c->markEnd,pos));
if(c->markEnd!=pos) {
if(c->markEnd<pos) {
cx=c->markEnd; cy=pos;
} else {
cx=pos; cy=c->markEnd;
}
if(cx<c->markStart) {
if(cy<c->markStart)
cy--;
} else
cx++;
while(cx<=cy) {
vcToggleMarkCell(c,cx);
cx++;
}
c->markEnd=pos;
}
}
} else if(c->currentlyMarking) {
int i,j;
if(c->markStart<c->markEnd) {
i=c->markStart; j=c->markEnd+1;
} else {
i=c->markEnd; j=c->markStart;
}
if(c->selection) free(c->selection);
c->selection=(char*)malloc(j-i+1);
memcpy(c->selection,c->screenBuffer+i,j-i);
c->selection[j-i]=0;
vcUnmark(c);
rfbGotXCutText(c->rfbScreen,c->selection,j-i);
}
defaultPtrAddEvent(buttonMask,x,y,cl);
}
void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl)
{
vncConsolePtr c=(vncConsolePtr)cl->screen->screenData;
if(c->selection) free(c->selection);
c->selection=(char*)malloc(len+1);
memcpy(c->selection,str,len);
c->selection[len]=0;
}
void vcToggleMarkCell(vncConsolePtr c,int pos)
{
int x=(pos%c->width)*c->cWidth,
y=(pos/c->width)*c->cHeight;
int i,j;
rfbScreenInfoPtr s=c->rfbScreen;
char *b=s->frameBuffer+y*s->width+x;
for(j=0;j<c->cHeight;j++)
for(i=0;i<c->cWidth;i++)
b[j*s->width+i]^=0x0f;
rfbMarkRectAsModified(c->rfbScreen,x,y,x+c->cWidth,y+c->cHeight);
}
void vcUnmark(vncConsolePtr c)
{
int i,j;
c->currentlyMarking=FALSE;
if(c->markStart<c->markEnd) {
i=c->markStart; j=c->markEnd+1;
} else {
i=c->markEnd; j=c->markStart;
}
for(;i<j;i++)
vcToggleMarkCell(c,i);
}
void vcProcessEvents(vncConsolePtr c)
{
rfbProcessEvents(c->rfbScreen,c->selectTimeOut);
}

@ -0,0 +1,95 @@
#include "rfb.h"
/* this is now the default */
#define USE_ATTRIBUTE_BUFFER
typedef struct vncConsole {
/* width and height in cells (=characters) */
int width, height;
/* current position */
int x,y;
/* characters */
char *screenBuffer;
#ifdef USE_ATTRIBUTE_BUFFER
/* attributes: colours. If NULL, default to gray on black, else
for each cell an unsigned char holds foreColour|(backColour<<4) */
char *attributeBuffer;
#endif
/* if this is set, the screen doesn't scroll. */
Bool wrapBottomToTop;
/* height and width of one character */
int cWidth, cHeight;
/* offset of characters */
int xhot,yhot;
/* colour */
unsigned char foreColour,backColour;
int8_t cx1,cy1,cx2,cy2;
/* input buffer */
char *inputBuffer;
int inputCount;
int inputSize;
long selectTimeOut;
Bool doEcho; /* if reading input, do output directly? */
/* selection */
char *selection;
/* mouse */
Bool wasRightButtonDown;
Bool currentlyMarking;
int markStart,markEnd;
/* should text cursor be drawn? (an underscore at current position) */
Bool cursorActive;
Bool cursorIsDrawn;
Bool dontDrawCursor; /* for example, while scrolling */
rfbFontDataPtr font;
rfbScreenInfoPtr rfbScreen;
} vncConsole, *vncConsolePtr;
#ifdef USE_ATTRIBUTE_BUFFER
vncConsolePtr vcGetConsole(int *argc,char **argv,
int width,int height,rfbFontDataPtr font,
Bool withAttributes);
#else
vncConsolePtr vcGetConsole(int argc,char **argv,
int width,int height,rfbFontDataPtr font);
#endif
void vcDrawCursor(vncConsolePtr c);
void vcHideCursor(vncConsolePtr c);
void vcCheckCoordinates(vncConsolePtr c);
void vcPutChar(vncConsolePtr c,unsigned char ch);
void vcPrint(vncConsolePtr c,unsigned char* str);
void vcPrintF(vncConsolePtr c,char* format,...);
void vcPutCharColour(vncConsolePtr c,unsigned char ch,
unsigned char foreColour,unsigned char backColour);
void vcPrintColour(vncConsolePtr c,unsigned char* str,
unsigned char foreColour,unsigned char backColour);
void vcPrintFColour(vncConsolePtr c,unsigned char foreColour,
unsigned char backColour,char* format,...);
char vcGetCh(vncConsolePtr c);
char vcGetChar(vncConsolePtr c); /* blocking */
char *vcGetString(vncConsolePtr c,char *buffer,int maxLen);
void vcKbdAddEventProc(Bool down,KeySym keySym,rfbClientPtr cl);
void vcPtrAddEventProc(int buttonMask,int x,int y,rfbClientPtr cl);
void vcSetXCutTextProc(char* str,int len, struct _rfbClientRec* cl);
void vcToggleMarkCell(vncConsolePtr c,int pos);
void vcUnmark(vncConsolePtr c);
void vcProcessEvents(vncConsolePtr c);
/* before using this function, hide the cursor */
void vcScroll(vncConsolePtr c,int lineCount);

@ -0,0 +1,32 @@
#include "VNConsole.h"
#include "vga.h"
int main(int argc,char **argv)
{
vncConsolePtr c=vcGetConsole(&argc,argv,80,25,&vgaFont,FALSE);
char buffer[1024];
int i,j,l;
for(j=32;j<256;j+=16) {
vcPrintF(c,"%02x: ",j);
for(i=j;i<j+16;i++)
vcPutChar(c,i);
vcPutChar(c,'\n');
}
i=0;
while(1) {
vcPrintF(c,"%d :> ",i);
vcGetString(c,buffer,1024);
l=strlen(buffer)-1;
while(l>=0 && buffer[l]=='\n')
buffer[l]=0;
//fprintf(stderr,"%s (%d)",buffer,strlen(buffer));
if(!strcmp(buffer,"quit"))
return(0);
if(!strcmp(buffer,"s"))
vcScroll(c,2);
if(!strcmp(buffer,"S"))
vcScroll(c,-2);
i++;
}
return(0);
}

@ -0,0 +1,261 @@
unsigned char vgaFontData[2399]={
0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c, /* 0 */
0x7e,0x81,0xa5,0x81,0x81,0xa5,0x99,0x81,0x81,0x7e, /* 1 */
0x7e,0xff,0xdb,0xff,0xff,0xdb,0xe7,0xff,0xff,0x7e, /* 2 */
0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10, /* 3 */
0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10, /* 4 */
0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c, /* 5 */
0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c, /* 6 */
0x60,0xf0,0xf0,0x60, /* 7 */
0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff, /* 8 */
0x78,0xcc,0x84,0x84,0xcc,0x78, /* 9 */
0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff, /* 10 */
0x1e,0x06,0x0e,0x1a,0x78,0xcc,0xcc,0xcc,0xcc,0x78, /* 11 */
0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x30,0xfc,0x30,0x30, /* 12 */
0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0, /* 13 */
0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0, /* 14 */
0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18, /* 15 */
0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80, /* 16 */
0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02, /* 17 */
0x30,0x78,0xfc,0x30,0x30,0x30,0xfc,0x78,0x30, /* 18 */
0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x00,0xcc,0xcc, /* 19 */
0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b, /* 20 */
0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c, /* 21 */
0xfe,0xfe,0xfe,0xfe, /* 22 */
0x30,0x78,0xfc,0x30,0x30,0x30,0xfc,0x78,0x30,0xfc, /* 23 */
0x30,0x78,0xfc,0x30,0x30,0x30,0x30,0x30,0x30,0x30, /* 24 */
0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xfc,0x78,0x30, /* 25 */
0x18,0x0c,0xfe,0x0c,0x18, /* 26 */
0x30,0x60,0xfe,0x60,0x30, /* 27 */
0xc0,0xc0,0xc0,0xfe, /* 28 */
0x28,0x6c,0xfe,0x6c,0x28, /* 29 */
0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe, /* 30 */
0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10, /* 31 */
/* 32 */
0x60,0xf0,0xf0,0xf0,0x60,0x60,0x60,0x00,0x60,0x60, /* 33 */
0xcc,0xcc,0xcc,0x48, /* 34 */
0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c, /* 35 */
0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18, /* 36 */
0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86, /* 37 */
0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76, /* 38 */
0x60,0x60,0x60,0xc0, /* 39 */
0x30,0x60,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x60,0x30, /* 40 */
0xc0,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0xc0, /* 41 */
0x66,0x3c,0xff,0x3c,0x66, /* 42 */
0x30,0x30,0xfc,0x30,0x30, /* 43 */
0x60,0x60,0x60,0xc0, /* 44 */
0xfe, /* 45 */
0xc0,0xc0, /* 46 */
0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80, /* 47 */
0x38,0x6c,0xc6,0xc6,0xd6,0xd6,0xc6,0xc6,0x6c,0x38, /* 48 */
0x30,0x70,0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0xfc, /* 49 */
0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe, /* 50 */
0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c, /* 51 */
0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e, /* 52 */
0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c, /* 53 */
0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c, /* 54 */
0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30, /* 55 */
0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c, /* 56 */
0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78, /* 57 */
0xc0,0xc0,0x00,0x00,0x00,0xc0,0xc0, /* 58 */
0x60,0x60,0x00,0x00,0x00,0x60,0x60,0xc0, /* 59 */
0x0c,0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x0c, /* 60 */
0xfc,0x00,0x00,0xfc, /* 61 */
0xc0,0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0xc0, /* 62 */
0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18, /* 63 */
0x7c,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c, /* 64 */
0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6, /* 65 */
0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc, /* 66 */
0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c, /* 67 */
0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8, /* 68 */
0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe, /* 69 */
0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0, /* 70 */
0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a, /* 71 */
0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6, /* 72 */
0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xf0, /* 73 */
0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78, /* 74 */
0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6, /* 75 */
0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe, /* 76 */
0xc6,0xee,0xfe,0xfe,0xd6,0xc6,0xc6,0xc6,0xc6,0xc6, /* 77 */
0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6, /* 78 */
0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 79 */
0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0, /* 80 */
0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e, /* 81 */
0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6, /* 82 */
0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c, /* 83 */
0xfc,0xfc,0xb4,0x30,0x30,0x30,0x30,0x30,0x30,0x78, /* 84 */
0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 85 */
0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x6c,0x38,0x10, /* 86 */
0xc6,0xc6,0xc6,0xc6,0xd6,0xd6,0xd6,0xfe,0xee,0x6c, /* 87 */
0xc6,0xc6,0x6c,0x7c,0x38,0x38,0x7c,0x6c,0xc6,0xc6, /* 88 */
0xcc,0xcc,0xcc,0xcc,0x78,0x30,0x30,0x30,0x30,0x78, /* 89 */
0xfe,0xc6,0x86,0x0c,0x18,0x30,0x60,0xc2,0xc6,0xfe, /* 90 */
0xf0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf0, /* 91 */
0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02, /* 92 */
0xf0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xf0, /* 93 */
0x10,0x38,0x6c,0xc6, /* 94 */
0xff, /* 95 */
0xc0,0xc0,0x60, /* 96 */
0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 97 */
0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c, /* 98 */
0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c, /* 99 */
0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76, /* 100 */
0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 101 */
0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0, /* 102 */
0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78, /* 103 */
0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6, /* 104 */
0x60,0x60,0x00,0xe0,0x60,0x60,0x60,0x60,0x60,0xf0, /* 105 */
0x0c,0x0c,0x00,0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0x78, /* 106 */
0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6, /* 107 */
0xe0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xf0, /* 108 */
0xec,0xfe,0xd6,0xd6,0xd6,0xd6,0xc6, /* 109 */
0xdc,0x66,0x66,0x66,0x66,0x66,0x66, /* 110 */
0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 111 */
0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0, /* 112 */
0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e, /* 113 */
0xdc,0x76,0x66,0x60,0x60,0x60,0xf0, /* 114 */
0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c, /* 115 */
0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c, /* 116 */
0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 117 */
0xcc,0xcc,0xcc,0xcc,0xcc,0x78,0x30, /* 118 */
0xc6,0xc6,0xd6,0xd6,0xd6,0xfe,0x6c, /* 119 */
0xc6,0x6c,0x38,0x38,0x38,0x6c,0xc6, /* 120 */
0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8, /* 121 */
0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe, /* 122 */
0x1c,0x30,0x30,0x30,0xe0,0x30,0x30,0x30,0x30,0x1c, /* 123 */
0xc0,0xc0,0xc0,0xc0,0x00,0xc0,0xc0,0xc0,0xc0,0xc0, /* 124 */
0xe0,0x30,0x30,0x30,0x1c,0x30,0x30,0x30,0x30,0xe0, /* 125 */
0x76,0xdc, /* 126 */
0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe, /* 127 */
0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c, /* 128 */
0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 129 */
0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 130 */
0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 131 */
0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 132 */
0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 133 */
0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 134 */
0x78,0xcc,0xc0,0xc0,0xcc,0x78,0x18,0x0c,0x78, /* 135 */
0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 136 */
0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 137 */
0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c, /* 138 */
0xcc,0x00,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 139 */
0x30,0x78,0xcc,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 140 */
0xc0,0x60,0x30,0x00,0x70,0x30,0x30,0x30,0x30,0x30,0x78, /* 141 */
0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6, /* 142 */
0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6, /* 143 */
0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe, /* 144 */
0xcc,0x76,0x36,0x7e,0xd8,0xd8,0x6e, /* 145 */
0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce, /* 146 */
0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 147 */
0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 148 */
0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 149 */
0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 150 */
0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 151 */
0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78, /* 152 */
0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 153 */
0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 154 */
0x30,0x30,0x78,0xcc,0xc0,0xc0,0xc0,0xcc,0x78,0x30,0x30, /* 155 */
0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc, /* 156 */
0xcc,0xcc,0x78,0x30,0xfc,0x30,0xfc,0x30,0x30,0x30, /* 157 */
0xf8,0xcc,0xcc,0xf8,0xc4,0xcc,0xde,0xcc,0xcc,0xcc,0xc6, /* 158 */
0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70, /* 159 */
0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76, /* 160 */
0x30,0x60,0xc0,0x00,0xe0,0x60,0x60,0x60,0x60,0x60,0xf0, /* 161 */
0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c, /* 162 */
0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76, /* 163 */
0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66, /* 164 */
0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6, /* 165 */
0x78,0xd8,0xd8,0x7c,0x00,0xfc, /* 166 */
0x70,0xd8,0xd8,0x70,0x00,0xf8, /* 167 */
0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c, /* 168 */
0xfe,0xc0,0xc0,0xc0,0xc0, /* 169 */
0xfe,0x06,0x06,0x06,0x06, /* 170 */
0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xdc,0x86,0x0c,0x18,0x3e, /* 171 */
0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x9e,0x3e,0x06,0x06, /* 172 */
0x60,0x60,0x00,0x60,0x60,0x60,0xf0,0xf0,0xf0,0x60, /* 173 */
0x36,0x6c,0xd8,0x6c,0x36, /* 174 */
0xd8,0x6c,0x36,0x6c,0xd8, /* 175 */
0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88, /* 176 */
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa, /* 177 */
0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77, /* 178 */
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 179 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 180 */
0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 181 */
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 182 */
0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 183 */
0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 184 */
0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 185 */
0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 186 */
0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 187 */
0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe, /* 188 */
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe, /* 189 */
0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8, /* 190 */
0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 191 */
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf8, /* 192 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff, /* 193 */
0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 194 */
0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 195 */
0xff, /* 196 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 197 */
0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 198 */
0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 199 */
0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xc0,0xfc, /* 200 */
0xfc,0xc0,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 201 */
0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff, /* 202 */
0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 203 */
0xd8,0xd8,0xd8,0xd8,0xd8,0xdc,0xc0,0xdc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 204 */
0xff,0x00,0xff, /* 205 */
0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 206 */
0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff, /* 207 */
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff, /* 208 */
0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 209 */
0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 210 */
0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xfc, /* 211 */
0xc0,0xc0,0xc0,0xc0,0xc0,0xf8,0xc0,0xf8, /* 212 */
0xf8,0xc0,0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 213 */
0xfc,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8,0xd8, /* 214 */
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, /* 215 */
0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /* 216 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8, /* 217 */
0xf8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 218 */
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 219 */
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 220 */
0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, /* 221 */
0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, /* 222 */
0xff,0xff,0xff,0xff,0xff,0xff,0xff, /* 223 */
0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76, /* 224 */
0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc, /* 225 */
0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 226 */
0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c, /* 227 */
0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe, /* 228 */
0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70, /* 229 */
0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0, /* 230 */
0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18, /* 231 */
0xfc,0x30,0x78,0xcc,0xcc,0xcc,0x78,0x30,0xfc, /* 232 */
0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38, /* 233 */
0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee, /* 234 */
0x3c,0x60,0x30,0x18,0x7c,0xcc,0xcc,0xcc,0xcc,0x78, /* 235 */
0x7e,0xdb,0xdb,0xdb,0x7e, /* 236 */
0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0, /* 237 */
0x38,0x60,0xc0,0xc0,0xf8,0xc0,0xc0,0xc0,0x60,0x38, /* 238 */
0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6, /* 239 */
0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe, /* 240 */
0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff, /* 241 */
0x60,0x30,0x18,0x0c,0x18,0x30,0x60,0x00,0xfc, /* 242 */
0x18,0x30,0x60,0xc0,0x60,0x30,0x18,0x00,0xfc, /* 243 */
0x70,0xd8,0xd8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, /* 244 */
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70, /* 245 */
0x30,0x30,0x00,0xfc,0x00,0x30,0x30, /* 246 */
0x76,0xdc,0x00,0x76,0xdc, /* 247 */
0x70,0xd8,0xd8,0x70, /* 248 */
0xc0,0xc0, /* 249 */
0xc0, /* 250 */
0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c, /* 251 */
0xd8,0x6c,0x6c,0x6c,0x6c,0x6c, /* 252 */
0x70,0xd8,0x30,0x60,0xc8,0xf8, /* 253 */
0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8, /* 254 */
/* 255 */
};
int vgaFontMetaData[256*5]={